Message from JavaScript discussions

February 2019

— My socket server (made with another programming language) sends the data divided into multiple namespaces, how can I connect to one of these from the javascript client?

Message permanent page

— 

I'm using socket.io got from https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.8/socket.io.min.js

— What issue are you getting with socket.io?

— I don't know what i've to do for connecting the namespace

— L00P will fit, better!

— For now, I did io.connect(SERVER); for connecting the default namespace, but how can i connect the "chat" namespace, for example?

Message permanent page

— Wat? You mean manual if else check

— Your HOST/ is the default
but HOST/NAMESPACE is the one you want.

— You have to create an io object every time you want to join a different namespace i think

— Manual?🤤

— Quoting the docs:

A new Socket instance is returned for the namespace specified by the pathname in the URL, defaulting to /. For example, if the url is http://localhost/users, a transport connection will be established to http://localhost and a Socket.IO connection will be established to /users.

Message permanent page

— Https://socket.io/docs/client-api/#IO