You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Socket.IO, it's possible to specify the path when initializing socket:
// io mocked with SocketIO from mock-server
const socket = io ('localhost:8080', {
path: '/hello/world',
}
// Results in connection to localhost:8080/hello/world
However, when connecting to mock-socket server, this path is truncated:
const serverPathInUrl = new Server ('localhost:8080/hello/world')
serverPathInUrl.on ('connection', socket => {
console.log ('This never gets called')
})
const serverPathSeparate = new Server ('localhost:8080')
serverPathSeparate.on ('connection', socket => {
console.log (socket.url)
// 'localhost:8080'
})
const serverPathSpecific = new Server ('localhost:8080' {
path: '/hello',
})
serverPathSeparate.on ('connection', socket => {
// Joyfully accepts connections from other paths
})
For an application that employs multiple sockets on the same host but different paths, what can be done to retrieve the path that was used for connection, or to only accept connections on given path?
The text was updated successfully, but these errors were encountered:
In Socket.IO, it's possible to specify the path when initializing socket:
However, when connecting to mock-socket server, this path is truncated:
For an application that employs multiple sockets on the same host but different paths, what can be done to retrieve the path that was used for connection, or to only accept connections on given path?
The text was updated successfully, but these errors were encountered: