qwertty01
V2EX  ›  问与答

React Websocket Stomp 怎么实时显示后端传过来的内容,有大佬给个思路吗?

  •  1
     
  •   qwertty01 · Sep 8, 2020 · 2289 views
    This topic created in 2264 days ago, the information mentioned may be changed or developed.

    RT 。。。在线等。。。急。。。

    3 replies  •  2020-09-08 10:17:36 +08:00
    qwertty01
    qwertty01
    OP
    Sep 8, 2020
    1
    我想了一下,订阅了 websocket 之后,异步返回,所以不能实时刷新
    BingoXuan
    BingoXuan
    Sep 8, 2020
    2
    不是有一个 onMessage 的 api 吗?按道理把更新页面的函数扔进去就好了。我写纯 js 也是把页面更新的 callback 放到 ws 的 onMessage 内
    qwertty01
    qwertty01
    OP
    Sep 8, 2020
    3
    @BingoXuan 好的,我去试试看
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4015 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 09:34 · PVG 17:34 · LAX 01:34 · JFK 04:34
    ♥ Do have faith in what you're doing.