miguelgrinberg / python-socketio

Python Socket.IO server and client
MIT License
3.96k stars 587 forks source link

Integrate msgpack.Timestamp with python datetime.datetime by default #1330

Closed dantetemplar closed 5 months ago

miguelgrinberg commented 5 months ago

What is this trying to address? Date and datetime objects are not serializable. You should not use them in Socket.IO payloads.

dantetemplar commented 5 months ago

What is this trying to address? Date and datetime objects are not serializable. You should not use them in Socket.IO payloads.

They are serializable effectively under msgpack transport, but some arguments needed to be passed.

miguelgrinberg commented 5 months ago

That is also true of any data type, and also possible to configure with JSON. But I prefer to avoid custom serializations. You can still use your custom packet class by passing it in the serializer argument when you create your server and client.