首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >调用未定义的方法Chatkit\Chatkit::sendMultipartMessage()

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

Stack Overflow用户
提问于 2019-04-10 14:46:27
回答 1查看 125关注 0票数 0

我安装了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",

代码语言:javascript
复制
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身份验证:

代码语言:javascript
复制
public function Authenticate(){
    return  new Chatkit([
        'instance_locator' => config('services.chatkit.locator'),
        'key' => config('services.chatkit.key'),
    ]);        
}
EN

回答 1

Stack Overflow用户

发布于 2019-04-10 16:13:21

您需要升级Chatkit库。您正在使用的方法已在v1.2中引入。有关详细信息,请参阅changelog

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55606306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档