Websockets, Angularjs and Ionic


#1

Hi! im new to ionic but lets say that i have a little experience with angularjs and i actually work as native android developer.

I’m developing an app that should display data realtime from a websocket. The thing is that the app is working completely fine on the browser but when i build it for android/iphone its not displaying the websocket data, in fact the nav title is not showing either.

What i do know:

  • The rest of my app is posting and getting data from a http backend, that’s working just fine.
  • The websocket works in the browser.

What i want to know:

  • Do i need to add a library to my project to connect/send to websockets?
  • It’s this problem/behavior caused by ionic?

Thanks in advance!


#2

A few questions:

What version of ionic are you using?
What version of android are you testing on?

I don’t have much experience with Websockets, but either way it’s more of an angular/cordova issue.
There is this plugin which could help


#3

Websockets are natively supported in ios but you need a plugin to work websockets in android (i.e. https://github.com/knowledgecode/WebSocket-for-Android).


#4

I’m using the latest version of ionic (1.0.0beta6). I’m testing on android 4.2.2 and android 4.4.2.
I’ll check the link and i’ll let you know if it worked. Thanks!


#5

So, i just need to add this plugin? i don’t need to change anything on my code?


#6

you don’t need to change any code, just need to add plugin.


#7

I already did, but it doesn’t seem to be working. i think i’m doing something wrong.