How can i make my springboot app websocket app get connected via a "ws://" url while using stomp

Oto-obong Eshiett :

I have a springboot app and i want to make the websocket connect via devices like phone so i am looking for a way to make my websocket have an entry point that starts with "ws://". When testing my default websocket url which is supposed to be "ws://localhost:8080/websocket-example" on "http://www.websocket.org/echo.html" it does not go through. but the sockjs calls it in my client side using ("http://localhost:8080/websocket-example") which works :

    var socket = new SockJS('http://localhost:8080/websocket-example');

    stompClient = Stomp.over(socket);

    stompClient.connect({},function (frame) {


}

I am presently using stomp on it and my configuration looks like this:

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer {


    @Override
    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
        stompEndpointRegistry.addEndpoint("/websocket-example")
                .setHandshakeHandler(new CustomHandshakeHandler()).setAllowedOrigins("*")
                .withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableSimpleBroker("/topic");
        registry.setApplicationDestinationPrefixes("/app");
    }
}

according to this post it said i could achieve a ws:// entrypoint by removing .withSockJS() which i did, but it still didnt work (on further reading, it was stated that this doesnt work on springboot). The other option was to remove stomp totally, this option works, but then i wouldn't be able to route messages directly to individuals users.

How can i create a ws:// entry point while maintaining stomp on my server side ?

airush :

I had a similar problem. Try this, should help.

var socket = new WebSocket('ws://localhost:8080/websocket-example/websocket');

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I control nginx reverse proxy with my java app?

分類Dev

How can I allow background music to continue playing while my app still plays its sounds while using Swift

分類Dev

How can I share an Image to my Cordova/PhoneGap App from another App?

分類Dev

How can I bundle my database file into my app, ready for a side load install?

分類Dev

How can I use universal links when I call openURL inside my own app?

分類Dev

How can I get Angular Material Icon to show the outline in my Angular app?

分類Dev

How can I make my app behave like I'm changing Application is agent(UIElement) at runtime using Swift?

分類Dev

How can I make url rewrite on google cloud app engine?

分類Dev

If I have location services turned on then how can my app get killed when it enters background mode?

分類Dev

Typescript error for "app.ws" using express-ws

分類Dev

How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console?

分類Dev

How do i get the launch intent for my work profile app from my app in the primary profile?

分類Dev

How can I protect my app from Google itself?

分類Dev

How can I retrieve nested firebase data in my ios app?

分類Dev

How can I connect my Flutter app to local sql server database using API?

分類Dev

When using SQLite3 and ExpressJs how do I make sure app.get() is not asynchronous while calling a db.each() method?

分類Dev

How can I pass my custom attributes to my redirect url in Azure AD App?

分類Dev

How can I custom my DataTable in React App

分類Dev

How can a JavaScript app detect if a Leap Motion device is connected

分類Dev

While my app is running, how can I update the current activity with the contents a GCM notification, without clicking on the notification?

分類Dev

How can I get the font names bundled in my iOS app?

分類Dev

In Corona SDK how can I put a score keeper into my app?

分類Dev

How do I Setup my UISearchBar connected to my UIWebView to be able to search on google with a word instead of a url using swift

分類Dev

Can web app listen() the websocket?

分類Dev

Can I get my IP address in a chrome app without using an external service?

分類Dev

How can I see my LAN when connected to a VPN?

分類Dev

How do I get my app to appear in the Applications list?

分類Dev

How can I quit when connected via telnet?

分類Dev

How can I know the usernames connected to my system?

Related 関連記事

  1. 1

    How can I control nginx reverse proxy with my java app?

  2. 2

    How can I allow background music to continue playing while my app still plays its sounds while using Swift

  3. 3

    How can I share an Image to my Cordova/PhoneGap App from another App?

  4. 4

    How can I bundle my database file into my app, ready for a side load install?

  5. 5

    How can I use universal links when I call openURL inside my own app?

  6. 6

    How can I get Angular Material Icon to show the outline in my Angular app?

  7. 7

    How can I make my app behave like I'm changing Application is agent(UIElement) at runtime using Swift?

  8. 8

    How can I make url rewrite on google cloud app engine?

  9. 9

    If I have location services turned on then how can my app get killed when it enters background mode?

  10. 10

    Typescript error for "app.ws" using express-ws

  11. 11

    How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console?

  12. 12

    How do i get the launch intent for my work profile app from my app in the primary profile?

  13. 13

    How can I protect my app from Google itself?

  14. 14

    How can I retrieve nested firebase data in my ios app?

  15. 15

    How can I connect my Flutter app to local sql server database using API?

  16. 16

    When using SQLite3 and ExpressJs how do I make sure app.get() is not asynchronous while calling a db.each() method?

  17. 17

    How can I pass my custom attributes to my redirect url in Azure AD App?

  18. 18

    How can I custom my DataTable in React App

  19. 19

    How can a JavaScript app detect if a Leap Motion device is connected

  20. 20

    While my app is running, how can I update the current activity with the contents a GCM notification, without clicking on the notification?

  21. 21

    How can I get the font names bundled in my iOS app?

  22. 22

    In Corona SDK how can I put a score keeper into my app?

  23. 23

    How do I Setup my UISearchBar connected to my UIWebView to be able to search on google with a word instead of a url using swift

  24. 24

    Can web app listen() the websocket?

  25. 25

    Can I get my IP address in a chrome app without using an external service?

  26. 26

    How can I see my LAN when connected to a VPN?

  27. 27

    How do I get my app to appear in the Applications list?

  28. 28

    How can I quit when connected via telnet?

  29. 29

    How can I know the usernames connected to my system?

ホットタグ

アーカイブ