【问题标题】:How to display a message from a stomp client into the view when a new message received without reloading the view当收到新消息而不重新加载视图时,如何将来自 stomp 客户端的消息显示到视图中
【发布时间】:2019-08-08 13:54:01
【问题描述】:

我即将使用 Angular 和 web-socket 创建一个聊天室,当从套接字接收到新消息时,我想将其显示到视图中而不重新加载页面,该消息显示在日志控制台中, 任何想法都可以帮助我

我尝试了 Angular 的 Life Cycle Hooks,但我无法解决问题

【问题讨论】:

    标签: angular websocket stomp


    【解决方案1】:

    只需将 webSocket 消息分配给将绑定到您的 html 的变量

    【讨论】:

    • 是的,这很简单,但是收到消息时必须显示我的消息
    猜你喜欢
    • 1970-01-01
    • 2019-07-04
    • 2017-08-03
    • 2015-06-04
    • 1970-01-01
    • 2016-04-29
    • 2019-12-21
    • 2020-10-15
    • 1970-01-01
    相关资源
    最近更新 更多