networked-game-0.1.0.1: Networked-game support library

Safe HaskellNone
LanguageHaskell98

NetworkedGame.Server

Synopsis

Documentation

data NetworkServer c w Source

Constructors

NetworkServer 

Fields

serverPort :: PortID
 
eventsPerSecond :: Int
 
onTick :: Handles -> Float -> w -> IO w
 
onConnect :: Handles -> ConnectionId -> w -> IO w
 
onDisconnect :: Handles -> ConnectionId -> w -> IO w
 
onCommand :: Handles -> ConnectionId -> c -> w -> IO w
 

serverMain Source

Arguments

:: Binary c 
=> NetworkServer c w

callbacks and settings

-> w

initial state value

-> IO () 

Main entry point for server

announce Source

Arguments

:: (MonadIO m, Binary c) 
=> Handles

Handles to send to

-> c

Message to send

-> m () 

Send a command to a collection of clients

announceOne Source

Arguments

:: (MonadIO m, Binary c) 
=> Handles

Current set of handles

-> ConnectionId

Index of handle to send to

-> c

Message to send

-> m () 

Send a command to a single client identified by id.