gpt4 book ai didi

websocket - 如何让 websockets 在 Elm 0.19 中工作

转载 作者:行者123 更新时间:2023-12-04 06:14:41 24 4
gpt4 key购买 nike

我正在尝试从 Elm 的 0.18 版升级到 0.19 版。我的项目依赖于 elm-lang/websocket在 0.18?我似乎无法在 0.19 中找到等效的包。我错过了什么?

最佳答案

websocket包目前为 Elm 0.19 重新设计,见 this issue :

This package has not been updated for 0.19 yet. I have heard lots of folks saying they need more features from this package, so I'd rather take that into consideration in the update rather than just doing the same stuff. I recommend using ports or 0.18 if you absolutely need this right this second.


编辑:2020 年 4 月 15 日更新
包已存档, Readme文件更新为
如下:

The recommended way to use WebSockets with Elm for now is throughports. You can see a minimal example in the js-integration-examplesrepo [IMAGE CLIPPED]

History

We had a bare bones version of WebSockets in within Elm in versions0.17 and 0.18, part of the introduction of subscriptions to Elm. But users found that the API was not able to cover a lot of situationsthey faced in practice. How can this work with Elixir Pheonix?Firebase? How can I use a different backoff strategy for reconnecting?How can I hear about when the connection goes down or comes back? Howabout sub-protocols?

In trying to expand the API to cover all the cases people were facingin practice, I came to think that it may not be possible with thecurrent subscriptions infrastructure. (My feeling is that effectmanagers may not be a great fit for web sockets because they do nothave great mechanisms for uniquely identifying resources. Do we haveone connections or two? How do we tell the difference? If it requiresfunction pointer equality, how can we make that reliable when ananonymous function is used?) I did not understand this problem as wellin 2016, and I think it manifested most clearly with web sockets.

So facing the prospect of either (1) having an API that manyeventually had to leave behind for ports or (2) recommending thatpeople go with ports from the start, we figured that (2) was probablythe best for someone new coming to Elm. That way they would hook up totheir preferred web socket manager without the intermediate step oflearning a promising but incomplete API.

关于websocket - 如何让 websockets 在 Elm 0.19 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52010340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com