Note that none of the examples in this page (or in any Elm tutorial I found) flesh out interaction with a backend.
Note that none of the examples in this page (or in any Elm tutorial I found) flesh out interaction with a backend.
That said, I've release a client/server game (online sailing regattas) in Elm & Play/Scala with websockets, and current API was enough for me: https://github.com/etaque/tacks
Sending data isn't hard. Sending the mouse coordinates on a click to the server over a websocket is super easy.
There is, however, no easy way to consume data and send a response. To write an echo server, for example, you currently have to send the data to a javascript port and then read from the port to send it back.
Incoming requests: --a------------->
Requests to server: ---b------------>
Responses from server: -----------d---->
Updates to app state: ---c--------e--->
a - User "sends message" to chat roomb - Handler for that action queues a request
c - Handler for that action also queues a local update
d - Server responds with the sent message
e - Handler for that response queues a local update
The TodoMVC example in Elm does this to use localStorage: https://github.com/evancz/elm-todomvc/blob/master/Todo.elm#L... and https://github.com/evancz/elm-todomvc/blob/master/index.html...
The same can be done for HTTP or WebSockets if you have needs that are not met by the existing APIs. Furthermore, the next major release is focused on drastically improving these APIs.
So there's a safety valve right now and there's a plan of how to make things excellent. I would not block on this, but I am also relatively biased :)