Connect with iOS and Android clients to SockJS Backend
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 leverage security integration that SockJS provides in Spring WebSockets and also other neat features from SockJS, such as rooms, subscriptions, etc. I was wondering if this is a good option to use so that mobile (iOS and Android) and Web client apps can easily connect to the backend server and perform messaging. If yes, then what libraries I can use for iOS and Android.
On SockJS GitHub page they are also listing available client libraries, but no iOS nor Android. So, I’m wondering if SockJS is even worth to use just because of that.
I found that for iOS client Primus-Objc (GitHub page) library claiming that they can connect to
native WebSockets, Socket.IO, SockJS or perhaps engine.io. is that a true statement? And event if that’s true, what about the quality of that library?
And event if it is ok to use SockJS on the back, then would it be also possible to show an example code for iOS and Android so that I can perform a proof of concept on mobile devices?
Another option can be to use Netty-Socket.io library and build each endpoint manually without any help from Spring Framework (which I’m considering to use) but there is small challenge that I’ll have to tackle, that is security. Somebody actually already tried to do it (the same author asking question on the official Netty-Socket.IO Github page) but looks like he didn’t have a luck in solving it yet.
- Phonegap - Save image from url into device photo gallery
- IOS cotrols hide and gone like android
- Google Play Services 8.4.0 breaks Google Cloud Messaging for Android if iOS is also used
- display connection error messages in ionic framework
- Why this deep link (applink), generated by facebook does not work?
- Are there any huge differences between objective-c and Java, or iPhone and Android?
3 Solutions Collect From Internet About “Connect with iOS and Android clients to SockJS Backend”
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.
Please find below useful references related to your requirement for both iOS and Android
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:
- App Store Submission: No Identities
- how to retrive all CNContactStore from device without filter
- How to convert an PFFile to an UIImage with swift?
- Present while a presentation is in progress? Trying to display a new view after facebook login with parse.
- Is it possible to turn on field debug drawing for SpriteKit in Xcode?
- Getting two different device IDs from same iphone
- Iphonesdk Merge three images two single image
- Check if the device datesettings is automatic in iOS
- provide simple method to get current speed (implementing speedometer)
- How to get email id of user using facebook sdk 4.7 in ios 9
- Android / iOS – Custom URI / Protocol Handling
- iOS app terminated due to memory pressure
- NSDateFormatter dateFromString returns date with wrong month
- Remove recent items in the Xcode's CheckOut window