Copyright | (c) Anton Gushcha, 2015-2016 |
---|---|
License | BSD3 |
Maintainer | ncrashed@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- class ActorMessage i => NetworkMessage i where
- type NetworkMessageType i :: *
- peerIndexedMessages :: forall m i a. (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> GameWire m a (Event (Seq (NetworkMessageType i)))
- peerProcessIndexed :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> (a -> NetworkMessageType i -> a) -> GameWire m a a
- peerProcessIndexedM :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> (a -> NetworkMessageType i -> GameMonadT m a) -> GameWire m a a
- peerSendIndexedM :: forall m i. (SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> MessageType -> NetworkMessageType i -> m ()
- peerSendIndexed :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> MessageType -> GameWire m (Event (NetworkMessageType i)) (Event ())
- peerSendIndexedDyn :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => ChannelID -> MessageType -> GameWire m (Event (Peer, i, NetworkMessageType i)) (Event ())
- peerSendIndexedMany :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i), Foldable t) => Peer -> ChannelID -> i -> MessageType -> GameWire m (Event (t (NetworkMessageType i))) (Event ())
- peerSendIndexedManyDyn :: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i), Foldable t) => ChannelID -> MessageType -> GameWire m (Event (t (Peer, i, NetworkMessageType i))) (Event ())
- filterMsgs :: Monad m => (a -> Bool) -> GameWire m (Event (Seq a)) (Event (Seq a))
Documentation
class ActorMessage i => NetworkMessage i Source
Extension for actor message, messages that are sent to remote host
type NetworkMessageType i :: * Source
Corresponding message payload for i
identifier, usually ADT
Getting messages
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> Peer | Which peer we are listening |
-> ChannelID | Which channel we are listening |
-> i | ID of actor |
-> GameWire m a (Event (Seq (NetworkMessageType i))) | Messages that are addressed to the actor |
Fires when network messages for specific actor has arrived Note: mid-level API is not safe to use with low-level at same time as first bytes of formed message are used for actor id. So, you need to have a special forbidden id for you custom messages.
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> Peer | Which peer we are listening |
-> ChannelID | Which channel we are listening |
-> i | ID of actor |
-> (a -> NetworkMessageType i -> a) | Handler of message |
-> GameWire m a a | Updates |
Same as peerIndexedMessages
, but transforms input state with given handler
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> Peer | Which peer we are listening |
-> ChannelID | Which channel we are listening |
-> i | ID of actor |
-> (a -> NetworkMessageType i -> GameMonadT m a) | Handler of message |
-> GameWire m a a | Updates |
Same as peerIndexedMessages
, but transforms input state with given handler, monadic version
Sending messages
:: (SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> Peer | Which peer we sending to |
-> ChannelID | Which channel we are sending within |
-> i | ID of actor |
-> MessageType | Strategy of the message (reliable, unordered etc.) |
-> NetworkMessageType i | Message to send |
-> m () |
Encodes a message for specific actor type and send it to remote host Note: mid-level API is not safe to use with low-level at same time as first bytes of formed message are used for actor id. So, you need to have a special forbidden id for you custom messages.
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> Peer | Which peer we sending to |
-> ChannelID | Which channel we are sending within |
-> i | ID of actor |
-> MessageType | Strategy of the message (reliable, unordered etc.) |
-> GameWire m (Event (NetworkMessageType i)) (Event ()) |
Encodes a message for specific actor type and send it to remote host, arrow version Note: mid-level API is not safe to use with low-level at same time as first bytes of formed message are used for actor id. So, you need to have a special forbidden id for you custom messages.
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) | |
=> ChannelID | Which channel we are sending within |
-> MessageType | Strategy of the message (reliable, unordered etc.) |
-> GameWire m (Event (Peer, i, NetworkMessageType i)) (Event ()) |
Encodes a message for specific actor type and send it to remote host, arrow version. Takes peer, id and message as arrow input.
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i), Foldable t) | |
=> Peer | Which peer we sending to |
-> ChannelID | Which channel we are sending within |
-> i | ID of actor |
-> MessageType | Strategy of the message (reliable, unordered etc.) |
-> GameWire m (Event (t (NetworkMessageType i))) (Event ()) |
Encodes a message for specific actor type and send it to remote host, arrow version Note: mid-level API is not safe to use with low-level at same time as first bytes of formed message are used for actor id. So, you need to have a special forbidden id for you custom messages.
:: (ActorMonad m, SyncMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i), Foldable t) | |
=> ChannelID | Which channel we are sending within |
-> MessageType | Strategy of the message (reliable, unordered etc.) |
-> GameWire m (Event (t (Peer, i, NetworkMessageType i))) (Event ()) |
Encodes a message for specific actor type and send it to remote host, arrow version. Takes peer, id and message as arrow input.