我在 WindowsRatchet Cakephp Plugin
上XAMPP
安装。使用 composer 安装插件。
Cakephp Version-
2.6.7
ratchet (Plugin) -
0.1.*
ext-libevent
not installed - 实际上我不知道如何在 Windows 上安装它。
当我开始 websocket - 使用命令
.\Console\cake Ratchet.websocket start
在浏览器的控制台显示
WebSocket connection to 'ws://localhost/websocket' failed: Error during WebSocket handshake: Unexpected response code: 404
Please suggest solution. Thanks in advance.
插件/棘轮/配置/botstrap.php
Configure::write('Ratchet', [
'Client' => [
'retryDelay' => 5000, // Not the best option but it speeds up development
'maxRetries' => 25, // Keep on trying! (Also not the best option)
],
'Connection' => [
'websocket' => [
'address' => '127.0.0.1',
'port' => 8080,
],
'external' => [
'hostname' => 'localhost',
'port' => 80,
'path' => 'websocket',
'secure' => false,
],
'keepaliveInterval' => 23, // Why 23? Because NGINX kills after 30 seconds, set to 0 to disable
],
]);