Skip to content

Commit e3ebfcf

Browse files
committed
2 parents 9509037 + c501d59 commit e3ebfcf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ws4py/client/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import types
66
from urlparse import urlsplit
7+
import json
78

89
from ws4py import WS_KEY
910
from ws4py.streaming import Stream
@@ -125,7 +126,10 @@ def send(self, payload, binary=False):
125126
self.write_to_connection(self.stream.text_message(payload).single(mask=True))
126127
else:
127128
self.write_to_connection(self.stream.binary_message(payload).single(mask=True))
128-
129+
130+
elif isinstance(payload, dict):
131+
self.write_to_connection(self.stream.text_message(json.dumps(payload)).single(mask=True))
132+
129133
elif type(payload) == types.GeneratorType:
130134
bytes = payload.next()
131135
first = True

0 commit comments

Comments
 (0)