How to use websites

How can I use data and drag and drop data to websocket using Fable? I found this github problem which suggests that this can be done, but cannot find any documentation or examples of how to achieve this.

+4
source share
1 answer

For those who later find this question via Google, here is the answer @Lawrence received from Maxime Mangel when he asked this question on Gitter:

Hello @lawrencetaylor, you can find an old sample here using websockets with FableArch. Do not consider the code 100% correct, because it is from an older version of fable-arch.

, , , websockets fable-arch. https://github.com/fable-compiler/fable-arch/commit/abe432881c701d2df65e864476bfa12cf7cf9343

websocket .

, -.

, -.

, , , , . Maxime Mangel, .

-

let webSocket =
    WebSocket.Create("wss://echo.websocket.org")

websocket

webSocket.send("Hello, socket!")

-

let webSocketProducer push =
  webSocket.addEventListener_message(
    Func<_,_>(fun e ->
      push(ReceivedEcho (unbox e.data))
      null
  )
)

createApp Model.initial view update
|> withProducer webSocketProducer
|> start renderer

. ReceivedEcho Action, fable-arch. withProducer fable-arch. . http://fable.io/fable-arch/samples/clock/index.html withProducer.

+5

Source: https://habr.com/ru/post/1658718/


All Articles