doc-push
doc-push copied to clipboard
Beginner tutorial building an IRC client
Concept: create IRC bot that connects to gitter
IRC is a very simple line-based protocol, we should be able to build a bot with a subset of the full-protocol (5-6 commands)
Draft sequence of steps:
- Connect to the server
- Send/Receive IRC messages
- bot says Hello
- bot respond to question
- no channel activity for certain amount of time, say "is anyone here?"
Key concepts - tcp socket, streams, reading and writing, framed codec, async, futures - canonical timeout & action
References
- building an IRC bot in Python
working on ideas for this tutorial here: https://github.com/ultrasaurus/irc-tokio
I've made a bit of progress, would love feedback, details in the repo README for now. Will work on figuring out what open questions I have and looking for answers or filing issues.
My biggest question is how to test something that uses a TcpStream. The tokio repo doesn't seem to have examples of that. Probably should structure the code differently to make it testable.
Abstracting over AsyncRead + AsyncWrite
is the usual advice there.