packages feed

socket-io 1.0.1 → 1.1.0

raw patch · 3 files changed

+24/−8 lines, 3 filesdep ~aesondep ~mtldep ~transformers

Dependency ranges changed: aeson, mtl, transformers

Files

Changelog.md view
@@ -1,3 +1,10 @@+## 1.1.0++* When building an initial routing table, you now have access to the `Socket`.++* `engineIOSocket` lets you access the underlying `engine-io` `Socket` for a+  Socket.io session.+ ## 1.0.1  * Increase upper-bound of engine-io to <1.2
socket-io.cabal view
@@ -1,5 +1,6 @@ name: socket-io-version: 1.0.1+version: 1.1.0+homepage: http://github.com/ocharles/engine.io license: BSD3 license-file: LICENSE author: Oliver Charles@@ -21,15 +22,15 @@     FlexibleContexts, OverloadedStrings, RankNTypes    build-depends:-    aeson >=0.7 && <0.8,+    aeson >=0.7 && <0.9,     attoparsec >=0.10 && <0.13,     base >=4.6 && <4.8,     bytestring >=0.10 && <0.11,     engine-io >= 1 && <1.2,-    mtl >=2.1 && <2.2,+    mtl >=2.1 && <2.3,     stm >=2.4 && <2.5,     text >=0.11 && <1.2,-    transformers >=0.2 && <0.4,+    transformers >=0.2 && <0.5,     unordered-containers >=0.2 && <0.3,     vector >=0.10 && <0.11 
src/Network/SocketIO.hs view
@@ -28,6 +28,7 @@     -- * Sockets   , Socket   , socketId+  , engineIOSocket    -- * Protocol Types   -- ** Packet Types@@ -159,7 +160,7 @@ initialize   :: MonadIO m   => EIO.ServerAPI m-  -> StateT RoutingTable m a+  -> StateT RoutingTable (ReaderT Socket m) a   -> IO (m ()) initialize api socketHandler = do   eio <- EIO.initialize@@ -167,7 +168,8 @@   let     eioHandler socket = do       let wrappedSocket = Socket socket eio-      routingTable <- execStateT socketHandler (RoutingTable mempty (const (return ())))+      routingTable <- flip runReaderT wrappedSocket $+        execStateT socketHandler (RoutingTable mempty (const (return ())))        return $ EIO.SocketApp         { EIO.saApp = flip runReaderT wrappedSocket $ do@@ -211,6 +213,12 @@ socketId :: Socket -> EIO.SocketId socketId = EIO.socketId . socketEIOSocket +-- | Retrieve the Engine.IO 'EIO.Socket' that underlies this Socket.IO socket.+-- This is a fairly low-level operation - you should take care when reading or+-- writing directly to this socket, as it is possible to break invariants that+-- Socket.io is expecting.+engineIOSocket :: Socket -> EIO.Socket+engineIOSocket = socketEIOSocket  -------------------------------------------------------------------------------- -- | A per-connection routing table. This table determines what actions to@@ -240,9 +248,9 @@   ----------------------------------------------------------------------------------- | When an event with a given name is received, and its arguments can be+-- | When an event with a given name is received, and its argument can be -- decoded by a 'Aeson.FromJSON' instance, run the associated function--- after decoding the event arguments.+-- after decoding the event argument. Expects exactly one event argument. on   :: (MonadState RoutingTable m, Aeson.FromJSON arg, Applicative m)   => Text.Text