We are developing a game using HTML5 technology for smartphone platform. Primarily the game should support iOS and Android platforms. Android does not provide web socket support currently. Though there are some open source implementation available but none of them work as is with SmartFoxServer 2X Javascript API. Here's the link to 2 implementations that we tried:
https://github.com/anismiles/websocket-android-phonegap
https://github.com/FreakDev/PhoneGap-An ... -WebSocket
Do you have any recommendations on this?
Android Websocket issue
Re: Android Websocket issue
Yes, the state of websocket support under Android is a bit strange. Mostly because it depends on which browser is installed as default by the major carriers. Sadly the default Android browser does not support websockets but Chrome and Firefox do.
You could detect the browser in use and warn the user that they need either Chrome or Firefox to play.
You could detect the browser in use and warn the user that they need either Chrome or Firefox to play.
Re: Android Websocket issue
Though it's an HTML5/Javascript app, we would bundle it in a native shell using frameworks like PhoneGap. So our application is not going to run directly on browser instead it would use the web view. Now with this information, what would you guys recommend?
Re: Android Websocket issue
But the web view is in fact an instance of the default browser renderer, I imagine.
In such case there's not much that can be done, because in essere you're running through those browser API which don't support websockets
In such case there's not much that can be done, because in essere you're running through those browser API which don't support websockets
Re: Android Websocket issue
Your replies are kind of making me nervous. At the moment, Android support for my app looks to be in the soup.
Have you had any experience with any of the open source Java implementation of Web sockets that's compatible with PhoneGap i.e.
https://github.com/anismiles/websocket-android-phonegap
https://github.com/FreakDev/PhoneGap-An ... -WebSocket
Has anyone tried these implementation to work with SmartFoxServer JS API?
Have you had any experience with any of the open source Java implementation of Web sockets that's compatible with PhoneGap i.e.
https://github.com/anismiles/websocket-android-phonegap
https://github.com/FreakDev/PhoneGap-An ... -WebSocket
Has anyone tried these implementation to work with SmartFoxServer JS API?
Re: Android Websocket issue
I have no experience with phone gap nor the libraries you have mentioned.
If you're using HTML5 you are using our JS API, but you are not working with a browser directly, instead you are using web-view via Phonegap in which you add these Java client libraries. Not only but you are also supposed to use a specific javascript library that provides the glue between the Java side (phonegap) and the HTML5 side.
All this I have deduced from the docs, but you haven't explained anything about what you're doing. So how did you integrate the js component in our API?
If you want help you should at least explain what you're doing.
Thanks
If you're using HTML5 you are using our JS API, but you are not working with a browser directly, instead you are using web-view via Phonegap in which you add these Java client libraries. Not only but you are also supposed to use a specific javascript library that provides the glue between the Java side (phonegap) and the HTML5 side.
All this I have deduced from the docs, but you haven't explained anything about what you're doing. So how did you integrate the js component in our API?
If you want help you should at least explain what you're doing.
Thanks
Re: Android Websocket issue
You got it right with your understanding on how things would work with framework like PhoneGap. And that's exactly what i'm doing.
Both the links that i have mentioned provides the Java based implementation of WebSocket and the corresponding WebSocket.js file. Once this is configured in PhoneGap environment, WebSocket call from SFS Javascript API would first go to WebSocket.js and internally it would be delegated to Java implementation.
However, during runtime i get tons of 'undefined' errors for variables and functions from SFS Javascript API.
Hope this would give you clarity on what i'm doing.
Both the links that i have mentioned provides the Java based implementation of WebSocket and the corresponding WebSocket.js file. Once this is configured in PhoneGap environment, WebSocket call from SFS Javascript API would first go to WebSocket.js and internally it would be delegated to Java implementation.
However, during runtime i get tons of 'undefined' errors for variables and functions from SFS Javascript API.
Hope this would give you clarity on what i'm doing.
Re: Android Websocket issue
Can you be more specific than that and provide details on which variables are reported as undefined?
Re: Android Websocket issue
For one of our projects we have the same issue. Even though newer Android phones support websockets, a large part of our target audience does not.
Unfortunately our budget does not have room to build seperate versions.
Our current approach is match the Java/Android library as a plugin with PhoneGap instead of just the websocket plugin as most websocket plugins are in beta or semi-complete.
We will keep you posted with our successes or failures. If you have any progress it would be nice to share this as well.
Unfortunately our budget does not have room to build seperate versions.
Our current approach is match the Java/Android library as a plugin with PhoneGap instead of just the websocket plugin as most websocket plugins are in beta or semi-complete.
We will keep you posted with our successes or failures. If you have any progress it would be nice to share this as well.
Re: Android Websocket issue
To help anyone. We successfully created a proof of concept in which we connected the Android API to Phonegap using the plugin system.
Now you know it works you should have no problem implementing this (if you have enough Phonegap/Smartfox) knowledge.
We tested it as far as connecting to the AdvancedChat and send a message which was received.
Now you know it works you should have no problem implementing this (if you have enough Phonegap/Smartfox) knowledge.
We tested it as far as connecting to the AdvancedChat and send a message which was received.
Re: Android Websocket issue
Thanks for posting and letting us know the results of your experiments.
Good to know that the integration is possible.
Cheers
Good to know that the integration is possible.
Cheers
Return to “SFS2X HTML5 / JavaScript API”
Who is online
Users browsing this forum: No registered users and 3 guests