You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hub_connection.on_open(lambda: print(" connection opened and handshake received ready to send messages"))
hub_connection.on_close(lambda: print("connection closed"))
hub_connection.on("ReceiveMessage", self.save_message())
hub_connection.start()
message = None
from signalrcore.subject import Subject
subject = Subject()
myCoolStreamItem = '{"protocol":"json","version":1}�'
# start Stream
hub_connection.send("UploadStream", subject)
# call next any time you need to upload a item
subject.next(myCoolStreamItem)
subject.complete()
def save_message(msg):
print(type(msg))
print(dir(msg))
with open(f"{uuid.uuid4()}.json", 'w+') as fh:
fh.write(json.dumps(msg))
Getting this error- raise TypeError(f'Object of type {o.class.name} '
f'is not JSON serializable')
E TypeError: Object of type WebSocketService is not JSON serializable
Please let me know how to correct it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My Code currently is : hub_connection = HubConnectionBuilder()
.with_url(SERVER_URL(design_id, connection_token), options={"verify_ssl": False,
"skip_negotiation": False,
"headers": {
"Cookie": "authorization={}".format(token)
}
})
.configure_logging(logging.DEBUG, socket_trace=True, handler=handler)
.with_automatic_reconnect({
"type": "interval",
"keep_alive_interval": 10,
"intervals": [1, 3, 5, 6, 7, 87, 3]
}).build()
def save_message(msg):
print(type(msg))
print(dir(msg))
with open(f"{uuid.uuid4()}.json", 'w+') as fh:
fh.write(json.dumps(msg))
Getting this error- raise TypeError(f'Object of type {o.class.name} '
f'is not JSON serializable')
E TypeError: Object of type WebSocketService is not JSON serializable
Please let me know how to correct it?
Beta Was this translation helpful? Give feedback.
All reactions