Example #1
0
 def relayData(self, data):
     if data == '':
         return
     try:
         packets = json.loads(data)
         for p in packets:
             RawWebSocket.relayData(self, p)
     except ValueError:
         RawWebSocket.close(self)
Example #2
0
 def relayData(self, data):
     if data == '':
         return
     try:
         packets = json.loads(data)
         for p in packets:
             RawWebSocket.relayData(self,p)
     except ValueError:
         RawWebSocket.close(self)
Example #3
0
 def close(self, code=3000, reason="Go away!"):
     RawWebSocket.write(self, 'c[%d,"%s"]' % (code, reason))
     RawWebSocket.close(self)
Example #4
0
 def prepConnection(self):
     RawWebSocket.write(self, "o")
Example #5
0
 def writeSequence(self, data):
     for d in data:
         d = normalize(d, self.factory.options['encoding'])
     RawWebSocket.write(self, "a" + json.dumps(data))
Example #6
0
 def write(self, data):
     data = normalize(data, self.factory.options['encoding'])
     RawWebSocket.write(self, "a" + json.dumps([data]))
Example #7
0
 def close(self, code = 3000, reason = "Go away!"):
     RawWebSocket.write(self,'c[%d,"%s"]' % (code, reason))
     RawWebSocket.close(self)
Example #8
0
 def prepConnection(self):
     RawWebSocket.write(self,"o")
Example #9
0
 def writeSequence(self, data):
     for d in data:
         d = normalize(d, self.factory.options['encoding'])
     RawWebSocket.write(self, "a"+json.dumps(data))
Example #10
0
 def write(self, data):
     data = normalize(data, self.factory.options['encoding'])
     RawWebSocket.write(self, "a"+json.dumps([data]))