Socket.IO

socket.io streaming binary data

自闭症网瘾萝莉.ら 提交于 2020-01-22 14:27:31
问题 I have just started using node.js, I'm running a node server with sockets.io and i need to send a buffer of bytes to the client. I understand that this can be done by first translating the byte buffer to base64 and sending that, then translating it back on the client side. but i was wondering if there is a more elegant way of getting the byte stream to the client. 回答1: Socket.IO 1.0 Now supports Binary data transfer. Please have a look here . You can use Blob, ArrayBuffer and File. 回答2: https

Audio streaming by websockets

心不动则不痛 提交于 2020-01-22 13:16:05
问题 I'm going to create voice chat. My backend server works on Node.js and almost every connection between client and server uses socket.io. Is websockets appropriate for my use case? I prefer communication client -> server -> clients than P2P because I expect even 1000 clients connected to one room. If websocket is ok, then which method is the best to send AudioBuffer to server and playback on other clients? I do it like that: navigator.getUserMedia({audio: true}, initializeRecorder,

Socket.io client in android connection with HTTPS protocol failed?

依然范特西╮ 提交于 2020-01-22 12:19:07
问题 io on server and client on android. It results in connection error on android as long as I enable HTTP(S) SSL(works fine if disable it however) I've tried to implement HTTPS connection on Android, took reference from sample on Github as following: opts = new IO.Options(); opts.sslContext = mySSLContext; opts.hostnameVerifier = myHostnameVerifier; socket = IO.socket("https://mychat.url", opts); also this SSLContext mySSLContext = SSLContext.getInstance("TLS"); mySSLContext.init(null, null,

What's the maximum number of rooms socket.io can handle?

心已入冬 提交于 2020-01-22 07:15:05
问题 I am building an app using socket.io I'm using socket.io's rooms feature, there are 5 "topics" a user can subscribe to. Each message broadcast in that topic has a message type, of which there are 100. A user will only receive the messages of the types they are allowed to receive, which could be between 30 and 70. My question: is it feasible to create a room for every topic + message type combination, which will be 5 x 100 rooms? Will socket.io perform well like this, or is there a better way

Application Error when attempting to deploy Node.js/Express/Socket.io application on Heroku

我的梦境 提交于 2020-01-22 05:51:06
问题 I am fairly new to all of these technologies (including somewhat JavaScript) so you might have to bear with me here. I followed the ChatApp tutorial over at Socket.IO docs fairly closely and modified the application to my likings somewhat; however, I don't think I changed much on the side of server interaction and stuff. My problem is no matter what I do, I can't seem to be able to get my application to successfully run on Heroku. I get this error message when trying to load the app:

Adding data to a socket.io socket object

柔情痞子 提交于 2020-01-21 11:11:58
问题 I am trying to add some custom information to my socket object on connect, so that when I disconnect the socket, I can read that custom information. IE: // (Client) socket.on('connect', function(data){ socket.customInfo = 'customdata'; }); // (server) socket.on('disconnect', function () { console.log(socket.customInfo); }); 回答1: Since it is JavaScript you can freely add attributes to any object (just as you did). However socket.io does give you a built-in way to do that (so you won't have to

Socket.IO - how to get different active user lists for different endpoints/rooms?

心不动则不痛 提交于 2020-01-21 09:41:06
问题 I am writing a simple socket.io(v1.3.6)-based chatting program. When users log in with their username, they could see several chatting rooms in dashboard and enter each of them via different end ponts, i.e, http://localhost:8080/api/chats/room01 . Users could chat in any one of these rooms. For each room, I would like to create an active user list. 'active' means this user is now connected to socket (chatting in this room). I see many questions have been posted but still confused by their few

Socket.io does not work on Firefox & Chrome

 ̄綄美尐妖づ 提交于 2020-01-21 09:17:09
问题 I'm trying to develop a simple chat application. Here is my chat.js file. var app = require('http').createServer(handler) , io = require('socket.io').listen(app) , fs = require('fs'); app.listen(8124); function handler (req, res) { fs.readFile(__dirname + '/chat.html', function (err, data) { if (err) { res.writeHead(500); return res.end('Error loading chat.html'); } res.writeHead(200); res.end(data); }); } io.sockets.on('connection', function (socket) { socket.on('addme',function(username) {

NodeJS Express not serving '/socket.io/socket.io.js'

穿精又带淫゛_ 提交于 2020-01-21 06:35:50
问题 I am trying to build NodeJS/Express/SocketIO application. Imports: var express = require('express') , app = express() , server = require('http').createServer(app) , io = require('socket.io').listen(server)... Configuration: app.configure(function(){ app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app

502 proxy error in Express.js while integrating with Apache [closed]

老子叫甜甜 提交于 2020-01-21 04:11:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am hosting apache and node.js server together with apache server proxying to node server.My framework is express.js and I am using amCharts.I have timeout for proxying set to 600.When I open my website I get only the static content and not the dynamic content of amCharts. This is my server side code: var