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
Copy file name to clipboardExpand all lines: README.rst
+47
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,7 @@ to 10, and all ``websocket.send!`` channels to 20:
171
171
If you want to enforce a matching order, use an ``OrderedDict`` as the
172
172
argument; channels will then be matched in the order the dict provides them.
173
173
174
+
.. _encryption
174
175
``symmetric_encryption_keys``
175
176
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
177
@@ -237,6 +238,52 @@ And then in your channels consumer, you can implement the handler:
237
238
asyncdefredis_disconnect(self, *args):
238
239
# Handle disconnect
239
240
241
+
242
+
243
+
``serializer_format``
244
+
~~~~~~~~~~~~~~~~~~~~~~
245
+
246
+
By default every message sent to redis is encoded using `msgpack <https://msgpack.org/>`_ (_currently ``msgpack`` is a mandatory dependency of this package, it may become optional in a future release_).
247
+
It is also possible to switch to `JSON <http://www.json.org/>`_:
**NOTE**: the registry allows you to override the serializer class used for a specific format without any check nor constraint. Thus it is recommended that to pay particular attention to the order-of-imports when using third-party serializers which may override a built-in format.
282
+
283
+
284
+
Serializers are also responsible for encryption using *symmetric_encryption_keys*. When extending ``channels_redis.serializers.BaseMessageSerializer`` encryption is already configured in the base class, unless you override the ``serialize``/``deserialize`` methods: in this case you should call ``self.crypter.encrypt`` in serialization and ``self.crypter.decrypt`` in deserialization process. When using a fully custom serializer, expect an optional sequence of keys to be passed via ``symmetric_encryption_keys``.
0 commit comments