Socket.IO

Missing name after . operator YUI Compressor for socket.io js files

你。 提交于 2019-12-23 06:56:56
问题 I am trying to use YUI compressor for socket.io based .js file (yes, I know it's server side script and doesn't require minfication, but it's requirement so I have a less control). My code is like this: fs.readFile('../examples/example.xml', function(err, data) { if (err) throw err; // parsing the new xml data and converting them into json file var json = parser.toJson(data); // adding the time of the last update json.time = new Date(); // send the new data to the client socket.volatile.emit(

Angular single page app and socketio multiple sockets

≡放荡痞女 提交于 2019-12-23 05:25:40
问题 I have yet to find a solution or any information on this topic. Basically I am developing a chat app with flask, socketio, and angularjs. I created a single page app with angularjs so when I click for example a register button this page comes into view even though it is not actually routing to a new page. The problem is when I click the register button or switch views another socket connection gets created. So when I go back to the chat app view to send a message it sends 3 messages because 3

Continuously Running Socket.io Service in Android

∥☆過路亽.° 提交于 2019-12-23 05:23:10
问题 I am developing a chat client using Socket.io as a means of communicating with the server. As such, using GCM is not exactly an option. I want be able to receive chats at any time (even if the application is closed); essentially the socket needs to be listening at all times. I understand that a service can be started when the phone boots and kept running. However, this seems to be a rather bad idea on a mobile device, draining battery and the like. Researching, it seems that GCM is the most

Data sent from node server using broadcast emit from another client is not able to be read by c++ socket io client

强颜欢笑 提交于 2019-12-23 05:13:57
问题 Node server 'use strict'; const express = require('express'); const app = express(); const serverHttp = require('http').Server(app); const io = require('socket.io')(serverHttp); const port = 8081; socket.on('JogCartesianButton', data => { socket.broadcast.emit('JogCartesianButton', data) console.log(data) }) serverHttp.listen(port, function() { console.log("init!!!"); }); data looks like this { q_value: [ 0, 0, 0, 0, 0, 0 ], status: false, joint: true, cartesian: false, freedrive: false,

How to not use localhost, but the IP of the server instead?

家住魔仙堡 提交于 2019-12-23 05:01:38
问题 I found this node application on this tutorial and wanted to use it, but it's configured to run as localhost. Since the application is run on Amazon Linux EC2, there is no desktop (local) access to it (maybe there's software to install to enable desktop mode, but I haven't got that). I'd like to run the application on the server, not on localhost, but on the server's Elastic IP address which I'll be adding to a Hosted Zone of my domain chatxs.com. I'd like to make the app listen for any

Using AJAX vs. socket.io socket messages

戏子无情 提交于 2019-12-23 04:55:20
问题 I am writing a chat application with friend request capabilities, and currently using socket.io events to send/receive messages between users. I'm conflicted on when to use AJAX and when to use sockets in the event that I have access to the socket. i.e. $.ajax({url:'friendAdd'}) vs socket.emit('friendAdd'); for all my friend request logic. Would it be better to stay consistent throughout the application and use sockets for all other requests, or are there reasons that using AJAX would be more

Node.js - io.sockets.in(room) not working

随声附和 提交于 2019-12-23 04:44:17
问题 client.on('msg', function(msg){ //io.sockets.in(msg.room).emit('msg', msg); client.get('room', function(err, room) { io.sockets.in(room).emit('msg',msg); }) }); is sending the message to ALL rooms and not just 'room' but I dont userstand why. I am using client.set("room",name,function(){ return true; }); I am setting the value on('join'), I dont see how its even an option to send to all rooms when using in() surely if it finds nothing it defaults to not sending to any, not sending to ALL? My

socket.io transport 'flashsocket' takes 5 seconds to start on IE 8

别等时光非礼了梦想. 提交于 2019-12-23 04:03:12
问题 This is running against localhost, with all other transports disabled for testing. When testing other transports on IE and other browsers, there's no such lag. Anything that can be done about this? I've got the latest Adobe Flash installed, running Windows 7 64bit, socket.io 0.9. 回答1: The problem is with how Flash policy server is working: it tries to connect to port 843 at first and obtain policy file. If there is no response within 5 seconds it tries to obtain policy file from server - and

node.js express mongodb save messages?

半腔热情 提交于 2019-12-23 03:36:07
问题 I'm trying to see express, mongoose and mongodb work togetter, in a really simple way. If I can have a box, put my name in there, submit it and have it save to the db, that's all i need. I tried doing this from taking pieces of tutorials but I'm stuck. I was trying to do it through a chat and just save every message. If you can get my example to work or have one of your own, either way, I't just helps me see something that works. Then I can have a foundation of what works and can add to it. I

Google Cloud Functions with socket.io

Deadly 提交于 2019-12-23 03:35:16
问题 My understanding is that to establish a persistent socket connection using socket.io the Node.js server should be always running. With Google Cloud Functions there isn't an always running Node.js server, so keeping a socket connection alive is not possible. Is Cloud Run with a running Node.js server the best option to handle multiple socket connections using socket.io ? 回答1: Neither Cloud Functions nor Cloud Run are able to support persistent socket connections for the same reasons. Each