Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use WebSockets or similar with a native Android application?

I have a Node.js app that uses HTTP / REST (using Express.js), and a native Android application that communicates with this. This works fine.

I am now looking at writing a more real-time version, which can push messages to a native client. Unfortunately, it needs to be a native client, as there is some fairly complex work done with the data that simply will not be possible in a mobile browser for the forseable future (otherwise I would just wait for WebSockets support to appear in the Android browser).

So, my question is what are my options?

I know about the Android Cloud to Device Messaging framework, but this requires registration and a Google sign-in, and I would much prefer the server to be client agnostic.

Is there a reliable WebSocket client that I can use (ideally) to talk to a Node.js server running Socket.io? Or any other native method (using the NIO classes)?

like image 930
backtick Avatar asked May 04 '11 23:05

backtick


People also ask

Can Android use WebSockets?

The WebSocket protocol paved the way to a truly realtime web. At the time of writing this article, the Android SDK does not have native support for WebSockets. However, it relies on the Java Development Kit (JDK), which includes support for WebSockets as part of javax. websocket package.

Do mobile apps use WebSockets?

Definitely, a WebSocket web app will run on any HTML5-compliant browser, including mobile browsers such as Safari for iOS and Chrome for mobile.

Can we use WebSocket in react native?

React Native also supports WebSockets, a protocol which provides full-duplex communication channels over a single TCP connection.


1 Answers

See Java socket.io client

like image 112
Femi Avatar answered Nov 15 '22 18:11

Femi