Socket.IO

Adding Socket.IO to existing Django/WSGI project

天涯浪子 提交于 2020-01-01 19:31:17
问题 This guy seems to be trying to do the same thing but the answer to his question isn't clear enough. I'm not all that familiar with setting up socket servers so I'm still a bit lost here. Has anyone accomplished this before? How do you spin up the socket server and keep it running? I wanted to comment on his post and ask him if he had success but I don't have enough reputation yet. 回答1: My final solution to this was using the built-in runserver_socketio command for the manage.py script,

Netty-Socketio with Spring Security

一世执手 提交于 2020-01-01 18:32:27
问题 I currently have a server implementation where a javascript front-end connects through the socketio protocol used by Netty-Socketio. The implementation works wonderfully with one flaw. From what I gather, the only way to make the websocket channel aware of the security context of the user is to pass up the JSESSIONID in the handshake, which means putting it on the client page. There is no way this is secure right? It would also mean that since we use an HTTPONLY header (Even more reason this

Connect JS client with Python server

こ雲淡風輕ζ 提交于 2020-01-01 17:00:09
问题 I'm relatively new to JS and Python, so this is probably a beginners question. I'm trying to send a string from a JS client to Python Server (and then send the string to another Python client). This is my code: JS client: var socket = io.connect('http://127.0.0.1:8484'); socket.send('lalala'); Python server: HOST = '127.0.0.1' PORT = 8484 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(2) #JS conn1, addr1 = s.accept() print 'Connected by', addr1 #PY conn2,

How can I prevent malicious use of my sockets?

ぐ巨炮叔叔 提交于 2020-01-01 15:38:52
问题 I'm making a webpage based around players being able to invite other players to parties, and other things a long the lines. I have your basic send / receive / update of the chat/users in your party. The only thing is, what's to stop somebody from sitting there opening up a developer console and going socket.emit('updateUsers', 'Weiner'); socket.emit('updateUsers', 'Idiot'); socket.emit('updateUsers', 'Bad word'); socket.emit('updateUsers', 'Other stupid malicious really long spam the chat

How can I prevent malicious use of my sockets?

蓝咒 提交于 2020-01-01 15:37:32
问题 I'm making a webpage based around players being able to invite other players to parties, and other things a long the lines. I have your basic send / receive / update of the chat/users in your party. The only thing is, what's to stop somebody from sitting there opening up a developer console and going socket.emit('updateUsers', 'Weiner'); socket.emit('updateUsers', 'Idiot'); socket.emit('updateUsers', 'Bad word'); socket.emit('updateUsers', 'Other stupid malicious really long spam the chat

Node.js : graceful restarts and server uptime, howto?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 15:34:08
问题 I've been working on a realtime app using Node.js and Socket.io , and I'd like to take it from the local testing stage to testing it out with some of our users. The trouble is, if I close the ssh session to my server it also stops the server I started using node app.js I thought about using nohup, but I occasionally get segmentation faults or other random errors that bring down the server. I need to 1) know when (and hopefully why) my server crashed so I can both work on improving it to crash

Node.js : graceful restarts and server uptime, howto?

烈酒焚心 提交于 2020-01-01 15:33:09
问题 I've been working on a realtime app using Node.js and Socket.io , and I'd like to take it from the local testing stage to testing it out with some of our users. The trouble is, if I close the ssh session to my server it also stops the server I started using node app.js I thought about using nohup, but I occasionally get segmentation faults or other random errors that bring down the server. I need to 1) know when (and hopefully why) my server crashed so I can both work on improving it to crash

Socket.IO disconnection problem before closing window

99封情书 提交于 2020-01-01 10:53:22
问题 I am trying to prevent the client from disconnecting from the server. So before the user closes the window on which the app is open, I do: $(window).bind("beforeunload", function() { return("Close the app?"); }); But the problem is that no matter if the user chooses to leave or stay on the page where the app is open, the client get's disconnected (stops listening) from the server, before even I chose an option. So if the user chooses to stay on the page, nothing will be sent or received from

Socket.IO disconnection problem before closing window

随声附和 提交于 2020-01-01 10:53:01
问题 I am trying to prevent the client from disconnecting from the server. So before the user closes the window on which the app is open, I do: $(window).bind("beforeunload", function() { return("Close the app?"); }); But the problem is that no matter if the user chooses to leave or stay on the page where the app is open, the client get's disconnected (stops listening) from the server, before even I chose an option. So if the user chooses to stay on the page, nothing will be sent or received from

Sails.js authorization for socket requests

浪子不回头ぞ 提交于 2020-01-01 09:15:13
问题 I'm trying to build a chat application based on sails.js. The url for messages from a specific chat looks like this: /api/chat/:id/messages When I request this url with XHR, it provides a session cookie and sails.js builds a session object. I can easily check user rights to read the messages from the specific chat. However, I need to request this url with socket.io so that the client can subscribe to all future changes of the messages collection. When I request this url with socket.io, no