{"_id":"57e10114ff540c22007b460c","githubsync":"","parentDoc":null,"__v":0,"category":{"_id":"57e0f141ff540c22007b45fa","version":"5703d527bb69fc1700553ce3","__v":0,"project":"5703d527bb69fc1700553ce0","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-20T08:20:17.405Z","from_sync":false,"order":3,"slug":"mtproto-module","title":"MTProto module"},"user":"5631f962c3b04b0d00ba9bf1","project":"5703d527bb69fc1700553ce0","version":{"_id":"5703d527bb69fc1700553ce3","hasDoc":true,"__v":6,"hasReference":true,"project":"5703d527bb69fc1700553ce0","createdAt":"2016-04-05T15:09:27.620Z","releaseDate":"2016-04-05T15:09:27.620Z","categories":["5703d527bb69fc1700553ce4","5703d8b7aceacc17003ef303","5703e60b6116142000db25f6","57e0db616a1c2e0e0081fe64","57e0f141ff540c22007b45fa","57e0f14b8929550e00f1d9bc"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.6","version":"0.0.6"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-20T09:27:48.706Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"This class is a runnable that is using Java nio's `Selector` to listen for incoming messages on multiple connections in a single thread, then spawn a runnable in a `CachedThreadPool` to actually read the message and dispatch it to the connection's subscriber.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"It's planned in the future to look for a library/implementation more stable and cleaner of this. This implementation works, but might not be optimal and contains unknown bugs.\\nI first tried to use netty, but it seems really complicate to implement, even to do basic stuff.\"\n}\n[/block]","excerpt":"com.github.badoualy.telegram.mtproto.MTProtoWatchdog","slug":"watchdog","type":"basic","title":"Watchdog"}

Watchdog

com.github.badoualy.telegram.mtproto.MTProtoWatchdog

This class is a runnable that is using Java nio's `Selector` to listen for incoming messages on multiple connections in a single thread, then spawn a runnable in a `CachedThreadPool` to actually read the message and dispatch it to the connection's subscriber. [block:callout] { "type": "info", "title": "Note", "body": "It's planned in the future to look for a library/implementation more stable and cleaner of this. This implementation works, but might not be optimal and contains unknown bugs.\nI first tried to use netty, but it seems really complicate to implement, even to do basic stuff." } [/block]