@@ -61,10 +61,11 @@ data WebSocketConfig t a
6161 = WebSocketConfig { _webSocketConfig_send :: Event t [a]
6262 , _webSocketConfig_close :: Event t (Word, Text)
6363 , _webSocketConfig_reconnect :: Bool
64+ , _webSocketConfig_protocols :: [Text]
6465 }
6566
6667instance Reflex t => Default (WebSocketConfig t a) where
67− def = WebSocketConfig never never True
68+ def = WebSocketConfig never never True []
6869
6970type WebSocket t = RawWebSocket t ByteString
7071
@@ -103,7 +104,7 @@ webSocket' url config onRawMessage = do
103104 liftIO $ threadDelay 1000000
104105 start
105106 start = do
106− ws <- newWebSocket wv url (onRawMessage >=> liftIO . onMessage) (liftIO onOpen) (liftIO onError) onClose
107+ ws <- newWebSocket wv url (_webSocketConfig_protocols config) (onRawMessage >=> liftIO . onMessage) (liftIO onOpen) (liftIO onError) onClose
107108 liftIO $ writeIORef currentSocketRef $ Just ws
108109 return ()
109110 performEvent_ . (liftJSM start <$) =<< getPostBuild
@@ -145,17 +146,21 @@ makeLensesWith (lensRules & simpleLenses .~ True) ''RawWebSocket
145146#else
146147
147148webSocketConfig_send :: Lens' (WebSocketConfig t a) (Event t [a])
148−webSocketConfig_send f (WebSocketConfig x1 x2 x3) = (\y -> WebSocketConfig y x2 x3) <$> f x1
149+webSocketConfig_send f (WebSocketConfig x1 x2 x3 x4) = (\y -> WebSocketConfig y x2 x3 x4) <$> f x1
149150{-# INLINE webSocketConfig_send #-}
150151
151152webSocketConfig_close :: Lens' (WebSocketConfig t a) (Event t (Word, Text))
152−webSocketConfig_close f (WebSocketConfig x1 x2 x3) = (\y -> WebSocketConfig x1 y x3) <$> f x2
153+webSocketConfig_close f (WebSocketConfig x1 x2 x3 x4) = (\y -> WebSocketConfig x1 y x3 x4) <$> f x2
153154{-# INLINE webSocketConfig_close #-}
154155
155156webSocketConfig_reconnect :: Lens' (WebSocketConfig t a) Bool
156−webSocketConfig_reconnect f (WebSocketConfig x1 x2 x3) = (\y -> WebSocketConfig x1 x2 y) <$> f x3
157+webSocketConfig_reconnect f (WebSocketConfig x1 x2 x3 x4) = (\y -> WebSocketConfig x1 x2 y x4) <$> f x3
157158{-# INLINE webSocketConfig_reconnect #-}
158159
160+webSocketConfig_protocols :: Lens' (WebSocketConfig t a) [Text]
161+webSocketConfig_protocols f (WebSocketConfig x1 x2 x3 x4) = (\y -> WebSocketConfig x1 x2 x3 y) <$> f x4
162+{-# INLINE webSocketConfig_protocols #-}
163+
159164webSocket_recv :: Lens' (RawWebSocket t a) (Event t a)
160165webSocket_recv f (RawWebSocket x1 x2 x3 x4) = (\y -> RawWebSocket y x2 x3 x4) <$> f x1
161166{-# INLINE webSocket_recv #-}