Answer the question
In order to leave comments, you need to log in
Socketio dynamic namespace?
Is there a user friendly interface to quickly switch between namespaces in socket.io?
To do something like
//client side
var socket = io("http://addr");
socket.of("/finance").on("buy", function(msg) {
console.log(msg);
});
socket.of("/history").on("new", function(msg) {
console.log(msg);
});
$("#history").click(function() {
socket.namespace("/history");
});
$("#finance").click(function() {
socket.namespace("/finance");
});
//server side
var io = require('socket.io').listen(9090);
io.of("/finance").on("connection", function(socket) {
socket.emit("buy", {data: "abc"});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question