Connect with iOS and Android clients to SockJS Backend

后端 未结 4 1960
误落风尘
误落风尘 2021-01-31 16:50

I\'m developing WebSocket messaging backend using Spring WebSockets, which uses SockJS + STOMP protocol. The reason why not to use plain WebSockets is because I will need to lev

相关标签:
4条回答
  • 2021-01-31 17:05

    Maybe it's more than a year since the question was asked. But, because it's getting in the first results when Googling for SockJS+Android. So, I am posting my answer.

    From my experience with a recent project I worked on, we were able to use a STOMP client - like the one here- to connect to Spring Websocket backend from native Android app.

    And from the browser, you can still use SockJS client to gain across browsers compatibility to websockets with fallback.

    A note to mention that when using only STOMP client to connect to native websocket the URL will be something like ws://mydomain/SockJSEndpoint/websocket, and when using SockJS client from the browser the URL will be like http://mydomain/SockJSEndpoint.

    0 讨论(0)
  • 2021-01-31 17:06

    SockJS may be interesting because it provides non-ws transports. Just using WebSockets may not be possible in all situations.

    There is one cross-platform SockJs client of the OpenFL project:

    https://github.com/jeremyfa/openfl-sockjs

    Not tested how well it works, but at least for Android it's using JavaScript from inside WebView, so should be no different than JavaScript one. Again, it is not clear how tightly it is coupled with OpenFL, but the approach of using WebView and stock SockJS client could probably be re-used.

    0 讨论(0)
  • 2021-01-31 17:23

    We have tested them, both Android-client (link) was given by @Amr K. Ismail and

    this iOS-client (link) are suitable with Spring-SockJS-Server which has STOMP.

    0 讨论(0)
  • 2021-01-31 17:24

    Please find below useful references related to your requirement for both iOS and Android

    1. http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps
    2. https://www.cometchat.com/blog/ios-android-chat-mobile-sdk/
    3. https://github.com/elabs/mobile-websocket-example
    0 讨论(0)
提交回复
热议问题