V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
qwertty01
V2EX  ›  问与答

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

  •  1
     
  •   qwertty01 · 2020-09-08 09:07:37 +08:00 · 1068 次点击
    这是一个创建于 1320 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    3 条回复    2020-09-08 10:17:36 +08:00
    qwertty01
        1
    qwertty01  
    OP
       2020-09-08 09:23:55 +08:00
    我想了一下,订阅了 websocket 之后,异步返回,所以不能实时刷新
    BingoXuan
        2
    BingoXuan  
       2020-09-08 09:50:59 +08:00
    不是有一个 onMessage 的 api 吗?按道理把更新页面的函数扔进去就好了。我写纯 js 也是把页面更新的 callback 放到 ws 的 onMessage 内
    qwertty01
        3
    qwertty01  
    OP
       2020-09-08 10:17:36 +08:00
    @BingoXuan 好的,我去试试看
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2719 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 05:26 · PVG 13:26 · LAX 22:26 · JFK 01:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.