我已经安装了chatkit 1.1版。我使用sendMessage()方法发送文本消息。现在,我想使用sendMultipartMessage()方法,但得到“调用未定义的方法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'
]
]
]);
推送身份验证:
public function Authenticate(){
return new Chatkit([
'instance_locator' => config('services.chatkit.locator'),
'key' => config('services.chatkit.key'),
]);
}