Skip to content

Instantly share code, notes, and snippets.

@Deisss
Deisss / myChatSystem.js
Created December 13, 2013 08:07
Simple multi chat room system using sockjs, tornado, and sockjsroom. To run it, simply do: 'python -m SimpleHTTPServer 7979' and navigate to localhost:7979 to see it in action. Explain: * socket.js should be always the same (for all project, it's just an helper to quickly have disconnect function and event support on top of SockJS) * myChatSyste…
/**
* Create a new socket instance between client and server,
* and start use it
*
* @method mySocketChatRoom
*
* @param roomId {String} A unique string to represent a single room
* @param username {String} The username to use on this room
*/
function mySocketChatRoom(roomId, username) {
@Deisss
Deisss / server.py
Last active December 31, 2015 05:29
Simple demo server using sockjs, tornado, and sockjsroom. <br /> This server implement a simple multi-chat room system. To run it: python server.py (with server.py, this file) The server will run on port 7878 (see the bottom of this file) and server on '/chat' namespace.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, logging, tornado.web
from datetime import datetime
from sockjs.tornado import SockJSRouter
from sockjsroom import SockJSRoomHandler