调用未定义的方法Chatkit \ Chatkit :: sendMultipartMessage()

时间:2019-04-10 06:46:27

标签: laravel pusher chatkit

我已经安装了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'),
    ]);        
}

1 个答案:

答案 0 :(得分:0)

您将需要升级Chatkit库。 v1.2中引入了您所使用的方法。有关详细信息,请参见changelog