首页 > 解决方案 > 调用未定义的方法 Chatkit\Chatkit::sendMultipartMessage()

问题描述

我安装了聊天工具包 1.1 版。我使用 sendMessage() 方法发送短信。现在我想使用 sendMultipartMessage() 方法,但得到“调用未定义的方法 Chatkit\Chatkit::sendMultipartMessage()”。sendSimpleMessage 也无法正常工作。

聊天工具版

“推/推-chatkit-server”:“^1.1”,“推/推-php-服务器”:“^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'),
    ]);        
}

标签: laravelpusherchatkit

解决方案


您将需要升级您的 Chatkit 库。您使用的方法是在 v1.2 中引入的。有关详细信息,请参阅更改日志


推荐阅读