doc-push icon indicating copy to clipboard operation
doc-push copied to clipboard

Beginner tutorial building an IRC client

Open ultrasaurus opened this issue 4 years ago • 3 comments

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:

  1. Connect to the server
  2. Send/Receive IRC messages
  3. bot says Hello
  4. bot respond to question
  5. 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

ultrasaurus avatar Sep 24 '19 20:09 ultrasaurus

working on ideas for this tutorial here: https://github.com/ultrasaurus/irc-tokio

ultrasaurus avatar Sep 24 '19 22:09 ultrasaurus

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.

ultrasaurus avatar Nov 23 '19 01:11 ultrasaurus

Abstracting over AsyncRead + AsyncWrite is the usual advice there.

Ralith avatar Nov 23 '19 19:11 Ralith