Register a callback to be called when the connection is established either initially or reconnected. This allows listeners to issue commands that are ephemeral to the connection, for example pub/sub subscription or key tracking. The callback must be a _method_ and
(self, callback)
| 967 | return PythonRespSerializer(self._buffer_cutoff, self.encoder.encode) |
| 968 | |
| 969 | def register_connect_callback(self, callback): |
| 970 | """ |
| 971 | Register a callback to be called when the connection is established either |
| 972 | initially or reconnected. This allows listeners to issue commands that |
| 973 | are ephemeral to the connection, for example pub/sub subscription or |
| 974 | key tracking. The callback must be a _method_ and will be kept as |
| 975 | a weak reference. |
| 976 | """ |
| 977 | wm = weakref.WeakMethod(callback) |
| 978 | if wm not in self._connect_callbacks: |
| 979 | self._connect_callbacks.append(wm) |
| 980 | |
| 981 | def deregister_connect_callback(self, callback): |
| 982 | """ |
no test coverage detected