laravel - 调用未定义的方法 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'),
]);
}
解决方案
您将需要升级您的 Chatkit 库。您使用的方法是在 v1.2 中引入的。有关详细信息,请参阅更改日志。
推荐阅读
- ruby-on-rails - 当您尝试使用 ActiveSupport 创建 -4 时区时,为什么 ActiveRecord 时区会返回 -03:00 时区?
- sed - 如何使用 WHM 中的终端使用 sed 查找和替换多个文件?
- c# - 我有一个要更改的变量名称的字符串
- javascript - 在浏览器中保存更改
- php - 我正在处理 CSV 导入脚本并不断收到 PHP 通知(尝试获取非对象的属性 'num_rows')
- javascript - 无法将文件上传到 Node JS
- png - gnuplot - 具有大量点的 eps
- vba - 访问 VBA 选择语句以计数为真有语法错误。要改变什么?
- monaco-editor - Adding monaco editor in devops work items extension
- python - 如何在不使用键盘或键盘中断的情况下打破实时循环收集数据?