metro-0.1.0.3: A simple tcp and udp socket server framework

Safe HaskellNone
LanguageHaskell2010

Metro.Class

Documentation

class Transport transport where Source #

Associated Types

data TransportConfig transport Source #

Methods

newTransport :: TransportConfig transport -> IO transport Source #

recvData :: transport -> Int -> IO ByteString Source #

sendData :: transport -> ByteString -> IO () Source #

closeTransport :: transport -> IO () Source #

class Servable serv where Source #

Associated Types

data ServerConfig serv Source #

type SID serv Source #

type STP serv Source #

Methods

newServer :: MonadIO m => ServerConfig serv -> m serv Source #

servOnce :: MonadUnliftIO m => serv -> (Maybe (SID serv, TransportConfig (STP serv)) -> m ()) -> m () Source #

onConnEnter :: MonadIO m => serv -> SID serv -> m () Source #

onConnLeave :: MonadIO m => serv -> SID serv -> m () Source #

servClose :: MonadIO m => serv -> m () Source #

class RecvPacket rpkt where Source #

Methods

recvPacket :: MonadIO m => (Int -> m ByteString) -> m rpkt Source #

class SendPacket spkt where Source #

Minimal complete definition

Nothing

Methods

sendPacket :: MonadIO m => spkt -> (ByteString -> m ()) -> m () Source #

sendPacket :: (MonadIO m, Binary spkt) => spkt -> (ByteString -> m ()) -> m () Source #

sendBinary :: (MonadIO m, Binary spkt) => spkt -> (ByteString -> m ()) -> m () Source #

class SetPacketId k pkt where Source #

Methods

setPacketId :: k -> pkt -> pkt Source #

class GetPacketId k pkt where Source #

Methods

getPacketId :: pkt -> k Source #