I like SignalR and I am developing 2 things.
Server side code
Client web app
The challenge is that I need to allow the server to be implemented in a non .NET environments like may be Java or PHP. In that case the client will be using
"SignalR" libraries and server has to match the SignalR implementation on the server (in PHP, Java, etc). In a way, what I am after is shipping a server side API and a .NET signalr based implementation, but allow anyone to be able to implement the server side API in php/java etc
For this, what I need the API sequence and protocol signalR uses. I am kind of thinking that this is not going to happen because SignalR is matched on the client and server side to talk in specific way to make the magic possible.
Has anyone else been in this predicament? Any ideas on what the best way to proceed? By the way, before you ask the question, if it is a pure websockets based app, I will have less problems, I can just user WebSockets standard APIs.
However, I might need to fallback on long polling, because my server might need to run on Windows 7 - where websockets is not available.
Instead of reverse engineer the SignalR protocol make sure the clients do not have direct dependency on SignalR. Create client side adapters for the different server side framework. Include the correct adapter depending on server side platform
Here is a description of the SignalR protocol.
Related
For the past 2 weeks I have been struggling to setup a simple backend that utilises gRPC and communicates with a mobile client.
Reading online about this technology it feels like it is the proper easy going solution for my needs.
Bridging client/server communication written in multiple languages Java/Kotlin/Swift/Go.
Backwards compatibility checks for the API realized with buf
Efficient communication by transferring binary data and utilising HTTP2
Support for both RPC and REST thanks to grpc-gateway
However when I decided to go down the gRPC path I faced a ton of issues (highlights of the issues, not actual questions):
How to share protobuf message definitions across clients and server?
How to manage third party protobuf message dependencies?
How to manage stub generation for projects using different build tools?
How to secure the communication using SSL certificates? Also keep in mind that here I am talking about a mobile client <--> server communication and not server <--> server communication.
How to buy a domain because SSL certificates are issued agains public domains in order to be trusted by Certificate Authorities?
How to deploy a gRPC server as it turns out that there aren't any easy to use PaaS that support gRPC and HTTP2? Instead you either need to configure the infrastructure like load balancers and machines hosting the server by installing the appropriate certificates or just host everything on your own bear metal.
How to manage all of the above in a cost effective way?
This is more of a frustration question.
Am I doing something wrong and misunderstanding how to use gRPC or is it simply too hard to setup for a small project that should run in production mod?
I feel like I wasted a ton of time without having made any progress.
My previous experience with SignalR was only as a server, getting data from a database and then updating the webpages accordingly.
I was wondering if it is possible to use SignalR to connect to other servers that shares data via Websockets and then consolidating the data to send out to your own clients, also using SignalR? So something like a forwarder of sorts.
You can use the .net signalR client to hook nearly anything to the server. There can be difficulties with waking the server up, so it is important to check the behavior.
https://learn.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-5.0&tabs=visual-studio
I have a task for my project to connect to ASP.NET SignalR websocket to fetch some data in real-time from Ruby program. The problem is I couldn't find any single SignalR client for Ruby. As I understand, SignalR version of websockets is a bit different from e.g. socket.io, there are some instances called "Hubs", so I guess special client is needed.
Can I connect to SignalR websocket from Ruby using any existing solutions, or do I need to write client from scratch?
Yes, you are right. Signalr server side is called Signalr hub and each client will be connected to this hub. Using socket.io client is not possible and you need a client supporting Signalr protocol.Unfortunately, there are no ruby projects or at least well-maintained ones right now.
You can implement a one which is sure not an overnight work or use a hack such as host an existing signalr client and talk to your ruby client from there.
I'm sure that was a confusing enough title.
I have a long running Windows service dealing with things happening in the world. This service is my canonical source of truth for the rest of my system. Now I want to slap a web interface onto this so the clients can see what is actually going on. At first this would simply be a MVC5 application with some Web API stuff. Then I plan to use SignalR 2.0 and Ember.js to make this application more interactive and "realtime".
The client communicates with the Windows Service over named pipes using WCF. A client (such as a web app) could request an instance of for example IEventService, would be given a WCF proxy client, and could read about events through this interface. Simple enough.
However, a web application basically just exists in the sense that it responds to requests from the user. The way I understand it, this is not the optimal environment for a long lived WCF client proxy to raise events in, and thus I wonder how to host my SignalR stuff. Keep in mind that a user would log in to the MVC5 site, but through the magic of SignalR, they will keep interacting with the service without necessarily making further requests to the website.
The way I see it, there are two options:
1) Host SignalR stuff as part of the web app. Find a way to keep it "long-running" while it has active clients, so that it can react to events on the WCF client proxy by passing information out to the connected web users.
2) Host SignalR stuff as part of my Windows service. This is already long-running, but I know nada about OWIN and what this would mean for my project. Also the SignalR client will have to connect to a different port than where the web app was served from, I assume.
Any advice on which is the right direction to go in? Keep in mind that in extreme cases, a web user would log in when they get to work in the morning, and only have signalr traffic going back and forth (i.e. no web requests) for a full work day, before logging out. I need them to keep up with realtime events all that time.
Any takers? :)
The benefit of self-hosting as part of your Windows service is that you can integrate the calls to clients directly with your existing code and events. If you host the SignalR server separately, you'd have another layer of communication between your service and the SignalR server.
If you've already decided on using WCF named pipes for that, then it probably won't make a difference whether you self-host or host in IIS (as long as it's on the same machine). The SignalR server itself is always "long-running" in the sense that as long as a client is connected, it will receive updates. It doesn't require manual requests from the user.
In any case, you'll probably need a web server to serve the HTML, scripts and images.
Having clients connected for a day shouldn't be a problem either way, as far as I can see.
I want to create a socket on the client to listen for notifications from the server. Is there any example of a socket server built that I can use in my asp.net application?
Asp.net is state-less you would need to build a windows service or windows application to publish a socket end-point unless you are looking at something like Comet?
Asp.net cannot fire server events if there is no intervention by a process or a user.
Can you describe your requirement a bit better?
https://github.com/SignalR/SignalR is a Server side and client side implementation of Comet it looks like a suitable solution for messaging purposes what are you attempting to build this might give more insight to a suitable solution.