最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

websocket - Can I use STOMP for Ajax-like requests? - Stack Overflow

programmeradmin4浏览0评论

My web page has a WebSocket connection with STOMP protocol.

I was wondering if I can use this channel with STOMP to send synchronous requests, like to an Ajax call (I know Ajax is considered asynchronous, but I meant it send the request and waits for the answer).

I tried to use STOMP messages, but I cannot easily link requests and responses.

My web page has a WebSocket connection with STOMP protocol.

I was wondering if I can use this channel with STOMP to send synchronous requests, like to an Ajax call (I know Ajax is considered asynchronous, but I meant it send the request and waits for the answer).

I tried to use STOMP messages, but I cannot easily link requests and responses.

Share Improve this question edited Mar 21 at 1:07 Justin Bertram 35.5k6 gold badges26 silver badges49 bronze badges asked Mar 20 at 21:33 TobiaTobia 9,57329 gold badges120 silver badges242 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

This is a pretty generic question so I'm going to give a pretty generic answer. This is not a "how to."

You can use STOMP in a request-reply pattern to mimic what you get with Ajax.

You can link requests and responses together using a correlation ID.

The specifics here will really depend on the message broker you use, but generally speaking the STOMP protocol is flexible enough to support your use-case.

发布评论

评论列表(0)

  1. 暂无评论