Skip to content

Instantly share code, notes, and snippets.

@jkp
jkp / websocketserver.py
Created Jul 18, 2012
A simple WebSockets server with no dependencies
View websocketserver.py
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'