Hi guys,
I've been trying to make a little multi-player game using Haskell/Elm and Websockets, and I've run into this problem trying to get the client to respond to messages from the server. As you see the clientMessages and serverMessages are defined in terms of each other which seems to cause a problem and I get this error:
Cannot read property 'value' of undefined
I've tried various things to try and break the cycle (e.g. using keepIf, merging the signal with a constant value etc.) but none successful so far.
If anyone can point me in the right direction, that'd be great!
Thanks!
Oliver
import Html
import String
import WebSocket
import Signal (keepWhen, Signal, constant, merge)
import Signal
clientMessages : Signal String
clientMessages = Signal.map String.toUpper serverMessages
serverMessages : Signal String
serverMessages = WebSocket.connect "ws://localhost:9160" clientMessages
view : String -> Html.Html
view str = Html.text str
main = Signal.map view clientMessages