我安装了聊天工具包 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'),
]);
}