qwertty01
V2EX  ›  问与答

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

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

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

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