Using socket.io with nodejs on a server with apache as a reverse proxy

前端 未结 3 408
执笔经年
执笔经年 2021-01-02 06:08

I\'m attempting to use Node.js with Socket.IO to faciliate messaging between the browser and client, following the guide.

However, I had to setup Node reverse-proxie

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 06:52

    I don't think this has anything to do with your apache proxy, but some 'quirks' with how socket.io handles requests on a sub-directory. See my answer here. NGINX configuration to work with Socket.IO

    Basically, you need to use this connect statement instead:

    var socket = io.connect('http://example.com', {resource:'nodejs/socket.io'});

提交回复
热议问题