Socket.IO

Socket.io not sending cookies in the handshake causing the request to stall

柔情痞子 提交于 2019-12-25 04:24:23
问题 Let me explain my setup. I have multiple domain names that are all CNAME records for a main domain name, such as example.com. example.com -> serverIP company1.example.com -> example.com company2.example.com -> example.com I'm basically developing white labeled versions of our software, where the software simply detects the referrer and knows which logos and stylesheet assets to load. So that is all well and good, however when socket.io tries to handshake to it's url that looks something like

AndroidAsync Socket.IO receive callback value

▼魔方 西西 提交于 2019-12-25 04:22:18
问题 I'm trying to build an application for Android using this library: https://github.com/koush/AndroidAsync and I was trying to receive a callback value from the server like this but the app crashes: client.emit("callbackTry", new Acknowledge() { @Override public void acknowledge(JSONArray arg0) { Log.e(TAG,"acknowledge: "+ arg0); } }); I leave you the server-side: socket.on('callbackTry', function (callback) { console.log(callback); var hello = "Hello"; callback(hello); }); How can I return the

node.js socket.io server long latency

六眼飞鱼酱① 提交于 2019-12-25 04:19:12
问题 I have a socket.io server on my node.js API. When the node.js server is doing nothing, the latency of pong event is usually 5-10 milliseconds. However, when the node.js server is processing some very complex http request, the latency jumps to more than 100 or even over 5000 causing ping timeout . I am curious about what is effecting the latency? And, our framework requires a stable socket connection to send infos of a long http request to same socket as the request was made. How can we make

NodeJS server not serving entire files?

匆匆过客 提交于 2019-12-25 04:15:57
问题 This is a classic "it worked last night when I went to bed!" situations... My site is built on the MEAN stack (meanjs.org), and my page now fails to load in Chrome and IE, but seems to work fine in FireFox. It simply displays a blank white screen. I see these as the first 2 errors in the console: socket.io.js:3032 Uncaught SyntaxError: Unexpected end of input angular.min.js:95 Uncaught SyntaxError: missing ) after argument list In inspecting those files, it seems they only loaded partially. I

NodeJS server not serving entire files?

白昼怎懂夜的黑 提交于 2019-12-25 04:15:35
问题 This is a classic "it worked last night when I went to bed!" situations... My site is built on the MEAN stack (meanjs.org), and my page now fails to load in Chrome and IE, but seems to work fine in FireFox. It simply displays a blank white screen. I see these as the first 2 errors in the console: socket.io.js:3032 Uncaught SyntaxError: Unexpected end of input angular.min.js:95 Uncaught SyntaxError: missing ) after argument list In inspecting those files, it seems they only loaded partially. I

Send data to selected socket_id

风格不统一 提交于 2019-12-25 03:34:56
问题 I'm using socket.io 1.3.5 and two method io.to(id).emit(event,data) and io.sockets.socket[id].emit(event,data) is not working. How to do send data to selected socket_id in socket.io 1.3.5 Sorry my english not good! 来源: https://stackoverflow.com/questions/29342449/send-data-to-selected-socket-id

JsHint throwing error regarding “Identifier expected after token”

£可爱£侵袭症+ 提交于 2019-12-25 03:25:19
问题 I have created one small chatting app using node.js and socket.io. It is working fine for me, but my editor's (Eclipse) plug-in JsHint showing me one error in my code as follows. io.sockets.in(room).emit(msgtype, data); Error: Syntax error on token ".", Identifier expected after this token above code is running very well for me, but editor showing me error. I don't understand what is the problem, I have google for same error, but still not getting any solution. If someone show me how to write

Connect to specific route via socket.io

给你一囗甜甜゛ 提交于 2019-12-25 03:16:49
问题 I need to access Web sockets via specific path, I mount my socket.io on the client with a path ('ws') Server code: var io = require('socket.io')(server, {path: '/notif'}); Client code: var socket = io('//127.0.0.1:7733/ws/', {path: '/notif'}); socket.connect(); This does not work due to “ws” on client. I suspect it's because I don't have the equivalent on the server (e.g. require server on specific path). (when removing the /rt mount, everything seems to work as expected). What is the server

socket.io, how to attach state to a socket room

时光毁灭记忆、已成空白 提交于 2019-12-25 03:08:00
问题 I was wondering if there was any way of attaching state to individual rooms, can that be done? Say I create a room room_name : socket.join("room_name") How can I assign an object, array, variable(s) to that specific room? I want to do something like: io.adapter.rooms["room_name"].max = maxPeople Where I give the room room_name a state variable max , and max is assigned the value of the variable maxPeople that is say type int. Max stores a variable for the maximum amount of people allowed to

iOS: How to display special characters in Swift [NSString]

自作多情 提交于 2019-12-25 02:57:36
问题 I am sending data via socket.io my app, which I want to embed the text of a parameter in a UILabel Javascript server socket.emit("app",{ac:"organización"}) iOS App var ac = self.jsonOFsocket["ac"] as String //ac === "organización" self.label.text = ac //self.label.text === "organizaci\U00f3n" The socket.io the app sends unencrypted characters. The app successfully receives all characters The app shows different symbols I try to do this: func utf(txt:String) -> NSString { var newTxt = NSString