Ich erhalte keine WebSocket -Verbindung zwischen Client -Skript und Server. />public function run()
{
$loop = Factory::create();
$pusher = new Pusher;
$context = new Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
$pull->on('message', array($pusher, 'onBlogEntry'));
// Set up our WebSocket server for clients wanting real-time updates
$webSock = new Server('0.0.0.0:8080', $loop); // Binding to 0.0.0.0 means remotes can connect
$webServer = new IoServer(
new HttpServer(
new WsServer(
new WampServer(
$pusher
)
)
),
$webSock
);
$loop->run();
< /code>
Und hier ist das Client -Skript: < /p>
var conn = new ab.Session('ws://localhost:8080',
function() {
/* subscribe to following topics */
conn.subscribe('new_order', function(topic, data) ..
< /code>
Dies funktioniert erneut im lokalen Setup.http://192.168.12.52:8094/xyz/new/....
< /code>
Ich habe auch versucht, das IP im Client -Skript anzugeben: < /p>
var conn = new ab.Session('ws://192.168.12.52:8080',
function() {
/* subscribe to following topics */
conn.subscribe('new_order', function(topic, data) ...
< /code>
In diesem Fall erhalte ich den folgenden Fehler: < /p>
WebSocket connection to 'ws://192.168.11.32:8080/' failed: Error during WebSocket handshake: Unexpected response code: 403
< /code>
Was fehlt hier? < /p>
WebSocket -Verbindung zu 'WS: // localhost: 8080/' fehlgeschlagen: Fehler im Verbindungsanbau: net :: err_connection_ref ⇐ Php
-
- Similar Topics
- Replies
- Views
- Last post