Hi, I’m trying to establish a connection between a QtWebsocket client and a Node.js websockets server. I’m using the bare minimum. On the Node.js side I’m. Using Primus to be able to easily switch to other web sockets implementations. S far I have only tried with websockets implementation and the source code resumes to the following lines:
'use strict'; var Primus = require('primus'); var http = require('http'); var server = http.createServer(); var primus = new Primus(server, { transformer: 'websockets' }); primus.on('connection', function(socket) { socket.on('data', function ping(message) { console.log('received a new message', message); socket.write({ ping: 'pong' }); }); }); server.listen(8080); And on the Qt side: connect(&_webSocket, SIGNAL(connected()), this, SLOT(onConnected())); connect(&_webSocket, SIGNAL(disconnected()), this, SLOT(onDisconnected())); connect(&_webSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); _webSocket.open(QUrl("ws://localhost:8080")); Where: void Controller::onConnected() { qDebug() << "on connected"; } void Controller::onDisconnected() { qDebug() << "on disconnected"; } void Controller::onError(QAbstractSocket::SocketError error) { qDebug() << "error" << error; } When I start the Qt app with the server already running nothing gets printed out to console. However… if I stop the server it displayed the following lines on the Qt app side: error QAbstractSocket::RemoteHostClosedError on disconnected Has anyone stumbled on a similar problem before? Thanks, Regards, Nuno
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest