我安装了chatkit 1.1版。我使用sendMessage()方法发送文本消息。现在我想使用sendMultipartMessage()方法,但是得到了"Call to undefined method Chatkit\Chatkit::sendMultipartMessage()“。sendSimpleMessage不能很好地工作。
Chatkit版本
"pusher/pusher-chatkit-server":"^1.1","pusher/pusher-php-server":"^3.4",
public function SendMessage(Request $request){
//return $request->all();
$user = $this->LoggedInUser();
$chatkit = $this->Authenticate();
$room_id = Session::get($user->username);
$chatkit->sendMultipartMessage([
'sender_id' => $user->username,
'room_id' => $room_id,
//'text' => $request->message,
'parts' => [
[ 'type' => 'image/png',
'url' => 'https://placekitten.com/200/300' ],
[ 'type' => 'text/plain',
'content' => 'simple text' ],
[ 'type' => 'binary/octet-stream',
'file' => file_get_contents('https://placekitten.com/200/300'),
'name' => 'kitten',
'customData' => [ "some" => "json" ],
'origin' => 'http://example.com'
]
]
]);Pusher身份验证:
public function Authenticate(){
return new Chatkit([
'instance_locator' => config('services.chatkit.locator'),
'key' => config('services.chatkit.key'),
]);
}发布于 2019-04-10 16:13:21
您需要升级Chatkit库。您正在使用的方法已在v1.2中引入。有关详细信息,请参阅changelog。
https://stackoverflow.com/questions/55606306
复制相似问题