Node.js and socket.io compatible with Qt?



  • Hi!

    I have a node.js server running (this code is only a part of my server) :

    var server = require('http').createServer(function(req, res)
    {
      res.writeHead(200, {'Content-Type' : 'text/html'});//Met OK dans le header, du HTML est à suivre
      res.end('<h1>Connected but no HTTP service available</h1>');//Message
    }).listen(8080, function ()
    {
      console.log("[HTTP] Starting at localhost:8080");
      console.log("[ IO ] Starting at localhost:8080\n");
    });
    
    var io = require('socket.io').listen(server);
    var clientsConnected = [];
    
    io.sockets.on('connection', function (socket) {
    
      var client = {name: "", type: "", number: -1};
    
      //we send confirmation to the client
      socket.emit('connection');
      
    });
    

    I want to connect my Qt client on this server, how can I do? I already try to use the Fortune Client Example here. It seems to connect to the server but I don't know how to send the 'connection' message to tell it to my server. Can you help me to manage it?

    I'm working on Windows 7 and I can't modify a lot my server because it's interacting with other applications.


  • Lifetime Qt Champion

    Hi,

    The Socket.io folks provide a sample with their C++ client implementation. See this blog post.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.