mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-21 07:26:39 +08:00
修正websocket连接地址
This commit is contained in:
parent
1f46f35a42
commit
6495cbfbe0
@ -49,8 +49,12 @@ class PublicController extends Controller
|
||||
|
||||
$content = [];
|
||||
|
||||
/**
|
||||
* ssl通过nginx转发实现
|
||||
*/
|
||||
if ($this->request->isSecure()) {
|
||||
$content['connect_url'] = sprintf('wss://%s/wss', $this->request->getHttpHost());
|
||||
list($domain) = explode(':', $websocket->connect_address);
|
||||
$websocket['connect_url'] = sprintf('wss://%s/wss', $domain);
|
||||
} else {
|
||||
$content['connect_url'] = sprintf('ws://%s', $websocket->connect_address);
|
||||
}
|
||||
|
@ -147,7 +147,8 @@ class Controller extends \Phalcon\Mvc\Controller
|
||||
* ssl通过nginx转发实现
|
||||
*/
|
||||
if ($this->request->isSecure()) {
|
||||
$websocket->connect_url = sprintf('wss://%s/wss', $websocket->connect_address);
|
||||
list($domain) = explode(':', $websocket->connect_address);
|
||||
$websocket->connect_url = sprintf('wss://%s/wss', $domain);
|
||||
} else {
|
||||
$websocket->connect_url = sprintf('ws://%s', $websocket->connect_address);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class ImController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @Post("/notice/read", name="home.im.read_notice")
|
||||
* @Get("/notice/read", name="home.im.read_notice")
|
||||
*/
|
||||
public function readNoticeAction()
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
||||
console.log('socket connect success');
|
||||
setInterval(function () {
|
||||
socket.send('ping');
|
||||
console.log('ping...');
|
||||
}, 1000 * parseInt(window.im.ws.ping_interval));
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,7 @@ layui.use(['jquery', 'layim'], function () {
|
||||
console.log('socket connect success');
|
||||
setInterval(function () {
|
||||
socket.send('ping');
|
||||
console.log('ping...');
|
||||
}, 1000 * parseInt(window.im.ws.ping_interval));
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ layui.use(['jquery', 'layer', 'laypage'], function () {
|
||||
}
|
||||
|
||||
function readNotices() {
|
||||
$.post('/im/notice/read');
|
||||
$.get('/im/notice/read');
|
||||
}
|
||||
|
||||
var action = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user