From 6f8e76adfd6cdeaafc039bdd91193e086ee8ac80 Mon Sep 17 00:00:00 2001 From: Sean Arietta Date: Tue, 23 Dec 2014 02:20:26 -0800 Subject: [PATCH] Added check to parser encoder to automatically encode json if the message data is not a string --- socketIO_client/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/socketIO_client/parser.py b/socketIO_client/parser.py index 4edd487..27a2d7f 100644 --- a/socketIO_client/parser.py +++ b/socketIO_client/parser.py @@ -98,6 +98,8 @@ class Message(): def encode_as_string(self): """Same as the encode_as_string method except it doesn't encode things as a JSON string""" + if not isinstance(self.message, basestring): + return self.encode_as_json(); data = self.message; if self.id is not None: data = str(self.id) + self.message;