_Boris _
2017-07-10 13:12:31 UTC
Hello,
I have implemented very straightforward converting received packet into Msg:
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.batch
[ WebSocket.listen wsServer decoderServerMsg
where decoderServerMsg:
decoderServerMsg : String -> Msg
decoderServerMsg rcvdStr = case JD.decodeString jsonDecServerMsg rcvdStr of
Ok serverMsg -> ServerMsgReceived serverMsg
Err err -> SystemError ("Failed to parser server msg:"++err++"
string:"++rcvdStr)
It works well as long as there is no fragmentation, ie. every packet
contains valid json payload.
My problem starts when packet exceeds about 4500 bytes and then it is
broken into two chunks.
I believe it very common case so before reinventing the wheel I wanted to
ask if there is already solution for this problem that I can use?
Thanks,
Boris
I have implemented very straightforward converting received packet into Msg:
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.batch
[ WebSocket.listen wsServer decoderServerMsg
where decoderServerMsg:
decoderServerMsg : String -> Msg
decoderServerMsg rcvdStr = case JD.decodeString jsonDecServerMsg rcvdStr of
Ok serverMsg -> ServerMsgReceived serverMsg
Err err -> SystemError ("Failed to parser server msg:"++err++"
string:"++rcvdStr)
It works well as long as there is no fragmentation, ie. every packet
contains valid json payload.
My problem starts when packet exceeds about 4500 bytes and then it is
broken into two chunks.
I believe it very common case so before reinventing the wheel I wanted to
ask if there is already solution for this problem that I can use?
Thanks,
Boris
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.