jupyter / nb2kg

Other
73 stars 31 forks source link

Clean up websocket handling #16

Closed kevin-bates closed 6 years ago

kevin-bates commented 6 years ago

Added some basic error handling improvements around the area of incomplete future handling. This tends to happen when the client application starts a kernel, sends some code, then exits. In those cases, the websocket connection doesn't have a chance to be satisfied and is disconnected before it has completed its connection sequence.

Also added logic to drop messages when the disconnect occurs during the read loop, but only after the read loop has processed some of the messages. Since there's no longer any connection to return the messages on, there's nothing to do. When debug is enabled, these will be logged, although no returned data will be included.

Increased the comments and clarified the use of client and server since client is meant to reference the Notebook client, but client was also used as the variable corresponding to the Gateway Server. That variable has been renamed to gateway and various comments have been modified to be explicit as to their target.

Removed use of the deprecated @json_errors decorator since the subclasses were already derived from APIHandler.

Fixed up a bunch of PEP notices produced by the IDE.

Fixes #15

lresende commented 6 years ago

LGTM