Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Node.js and socket.io compatible with Qt?
QtWS25 Last Chance

Node.js and socket.io compatible with Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vunnm
    wrote on last edited by Vunnm
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved