-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathSocketIO.hs
66 lines (59 loc) · 1.57 KB
/
SocketIO.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--------------------------------------------------------------------------------
-- | Socket.IO for Haskell folks.
module Web.SocketIO
(
-- * How to use this module
-- |
--
-- Note that most of the string literals below are of type Lazy Text.
--
-- >{-# LANGUAGE OverloadedStrings #-}
-- >
-- >import Web.SocketIO
-- >
-- >-- listens to port 4000
-- >main = server 4000 $ do
-- >
-- > -- send something to the client
-- > emit "some event" ["hey"]
-- >
-- > -- ping-pong
-- > on "ping" $ do
-- > emit "pong" []
-- >
-- > -- do some IO
-- > on "Kim Jong-Un" $ liftIO launchMissile
-- >
-- > -- broadcast
-- > broadcast "UN" "North Korea is best Korea"
-- * Running a standalone server
server
, serverConfig
, defaultConfig
, Configuration(..)
, Port
, Transport(XHRPolling)
-- * Sending and receiving events
, Subscriber(..)
, Publisher(..)
, reply
, msg
, msg'
, getEventName
, HasSessionID(..)
, EventName
, SessionID
-- ** Special events
-- | On disconnection
--
-- @
-- 'on' \"disconnect\" $ do
-- liftIO $ print \"client disconnected\"
-- @
-- * Types
, HandlerM
, CallbackM
) where
import Web.SocketIO.Types
import Web.SocketIO.Server
import Web.SocketIO.Event