Reflex bindings for libtelnet.
Wraps https://git.sr.ht/~jack/libtelnet-haskell , so you can handle telnet data streams using reflex Reflex.Event
s. See README.md
or Reflex.LibTelnet
to get started.
Reflex Bindings to libtelnet
This is a reflex wrapper around libtelnet, which lets you describe data flows through the telnet state tracker using reflex Event
s.
This library thinly wraps the libtelnet functions, so you should read the libtelnet documentation alongside the haddocks for this package.
Quick Start
Assemble a
config :: TelnetConfig t
, which holds the event streams that feed into a telnet state tracker. The easiest way to do this is to callnewTelnetConfig
and overwrite the fields you care about using record updates or lenses. You will almost certainly want to overwriterecv
to be the stream of incoming data from a socket, andsend
to be the stream of outgoing data from your application.- If you want to use lenses, use the
generic-lens
orgeneric-optics
to get your preferred flavour of optic. Make sure to use thefield' @"fieldName"
version (i.e. not#fieldName
or un-primedfield
), otherwise GHC will struggle to infer the type oft
when setting fields inReflexConfig t
.
- If you want to use lenses, use the
Call
telnet config
, and save the resultingTelnetEvents t
. This structure holds the output event streams from a single telnet state tracker.Wire the output events into your application.
Other Resources
A telnet echo server exists in the
reflex-libtelnet
repo, outside this package. It is packaged separately so that it can be licensed more permissively, and to minimisereflex-libtelnet
's dependency footprint.Questions should go to the reflex-libtelnet-discuss mailing list.
Bug reports should go to the bug tracker.