import hashlib
import base64

OP_CONT=0
OP_TEXT=1
OP_BIN=2
OP_CLOSE=8
OP_PING=9
OP_PONG=10
def _HWORD(x):
    return chr(x>>8)+chr(x&0xff)
CLOSE_NORMAL=_HWORD(1000)
CLOSE_GOING_AWAY=_HWORD(1001)
CLOSE_PROTOCOL_ERROR=_HWORD(1002)
CLOSE_BAD_TYPE=_HWORD(1003)
CLOSE_BAD_DATA=_HWORD(1007)
CLOSE_POLICY_VIOLATION=_HWORD(1008)
CLOSE_TOO_BIG=_HWORD(1009)
CLOSE_EXTENSION_NEEDED=_HWORD(1010)
CLOSE_UNEXPECTED_CONDITION=_HWORD(1011)

opcodes = (OP_CONT,OP_TEXT,OP_BIN,OP_CLOSE,OP_PING,OP_PONG)
