Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR & Android, what are my options? [closed]

I'm developing an ASP.NET MVC app that is consumed by both by JavaScript in the browser and by a native Android app, and I wish to use SignalR. This is of course no problem in the browser, but I do not know how to interface from the Android app.

Are my only options:

  1. Find a pre-existing Android SignalR library. or
  2. Write custom code to interface with the server side SignalR interface?
like image 304
Mr. Flibble Avatar asked Jul 28 '12 01:07

Mr. Flibble


People also ask

What is SignalR and its client?

In this article, we are going to learn the fundamentals of SignalR and its client. SignalR is a new developer's API provided for ASP.NET Web Applications by Microsoft. It used to add "real time" Web functionality to ASP.NET Applications. "Real Time" Web functionality is the ability of a Server code to push the contents to the connected clients.

What is ASP SignalR?

ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications.

What is the communication flow in SignalR?

In typical web applications, the communication flow is one-way, i.e. from client to the server. The client initiates a request to the server, the server performs some task, and sends the response to the client. SignalR is an open-source project that enables real-time, bi-directional web communication from server to clients.

What is SignalR hub?

Any class that is Inherited from HUB class is a SignalR Hub.Hub is a Server side material and needs to be hosted. For .NET, we have 2 clients that is (jQuery client and have ASP.NET client). So from here we will check how we can work with signalR.


4 Answers

I was also searching for a SignalR-client for Android, but i didnt find one so I started to develop one by myself. You can checkit out at https://github.com/erizet/SignalA. Curently it's more like a proof-of-concept than a finnished library. It's now updated to protocol version 1.2 which is used in the 1.0 release of SignalR.

like image 126
Erik Z Avatar answered Oct 03 '22 19:10

Erik Z


I'm unaware of any Java based implementation that you could use in an Android application right now. So I think you're looking at option #2.

Java certainly has the core functionality needed to to be able to communicate with at least the long-polling transport implementation of SignalR pretty easily. You'd just be looking at combining HttpClient with org.json.

like image 38
Drew Marsh Avatar answered Oct 03 '22 18:10

Drew Marsh


Host a hidden webview in your application and use the script bridge to talk to it. Use the javascript signalr libraries in your webview.

like image 44
Greg Ennis Avatar answered Oct 03 '22 18:10

Greg Ennis


If HTML5-based Android app is an option, you can try using native SignalR JavaScript client. Works flawlessly.

like image 23
Piotr Szmyd Avatar answered Oct 03 '22 17:10

Piotr Szmyd