How do I get socket.io running for a subdirectory

前端 未结 4 1938
广开言路
广开言路 2021-02-02 10:46

I\'ve got a proxy running that only hits my node.js server for paths that being with /mysubdir How do I get socket.io configured for this situation?

In my c

4条回答
  •  生来不讨喜
    2021-02-02 11:04

    In my server I had to

    var io = require('socket.io')(httpServer, {path: '/mysubdir/socket.io'})`
    

    In my client I had to

    
    

    and also

    var socket = io.connect('http://www.example.com', {path: "/mysubdir/socket.io"});`
    

提交回复
热议问题