Using SignalR with ElastiCache fails - c#

We have C# application using SignalR and Amazon's ElastiCache as backplane. However even SignalR allows to mask out certain commands it stills sends a CONFIG to the ElastiCache which fails SignalR silently (CONFIG is not supported by ElastiCache). For now we compile our own binary of SignalR with the change of removing the auto reconfiguration routine.
I wonder if anyone else tripped over this issue and wanted to see how you solved it.
The best idea would be to write a proxy for ElastiCache (like the Twitter proxy) but that is a huge undertaking.
Thanks in advance.

In this case client is important and Baking your own SignalR definitly bad practice. Did you check this page http://www.asp.net/signalr/overview/performance/scaleout-with-redis: This method uses StackExchange.Redis(StrongName) and StackExchange.Redis has many options for connection.
We are using same method described in the page on AWS with Elasticache Redis and we don't have any issues you had...
Regards...

Related

How can I send a SignalR message from an Azure Function without using Azure SignalR Service

I have an older C# app that is being migrated to the cloud. It uses SignalR, but only direct client/server connections. No SignalR service is involved yet.
I am extracting some processes that are well suited for an Azure function, but one feature I would prefer to not have to redesign for this MVP is a SignalR message back to the user that tells them the percent complete for this job.
I am reading the MS documentation from here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=in-process&pivots=programming-language-csharp focusing on Isolated-Processes.
I can see how I can send messages to the Azure SignalR service, but I am unclear how I might be able to just send a message back to the caller.
I would really like to set up a simple Hub and send messages directly to the client as the function progresses.
I would suggest giving web pub sub a look? Microsoft has a good comparison article here. Summary, it is a bit more language agnostic, and if you're already using azure then it has less setup overhead than SignalR.
https://dev.to/albertbennett/how-to-azure-pubsub-service-2ccb

C# Singalr to receive data from backand servers

I have a chat SignalR server, the chat support group chatting.
I also have a server which actually creates the groups and other group managment tools.
Whenever a user leaves a group (via http post ) to server, I want the chat service to trigger some methods, such as LeaveGroup and some other logictics.
I bound the connectionId to userId so I got the parsing request covered.
QUESTION IS: What is the best practice of communication between server/service and the signalr server.
Taking in mind, I dont want to compormise on scalability on each of my servers/services.
My idea is more or less host a web api server inside the SignalR server, but I can't seem to find any topics suggesting that could damage the performance.
Ideas?
Thanks alot.
p.s
I know that there is no code involved in here. but it seems irrelevant. I have self hosted web api in a window service I have, so the code is pretty much the same.
I would love to provide more data/information if thats neccesary
It seems like this documentation is most applicable to what you're trying to do: https://www.asp.net/signalr/overview/getting-started/tutorial-server-broadcast-with-signalr
It speaks specifically about how to communicate from your server/service application to the signalr clients. Communicating from the client to the server/service could be done either through the signalr hub, or with other web API.
From a best practice perspective, the documentation specifically states (https://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-server#callfromoutsidehub):
If you need to use the context multiple-times in a long-lived object,
get the reference once and save it rather than getting it again each
time. Getting the context once ensures that SignalR sends messages to
clients in the same sequence in which your Hub methods make client
method invocations. For a tutorial that shows how to use the SignalR
context for a Hub, see Server Broadcast with ASP.NET SignalR.
If you're really into scalability, you might want to look into integrating your signalr communications into some other message queueing system, but that's probably overkill for most circumstances.

Websockets with ASP.NET MVC / MVVM

Earlier today I came across Kaazing's WebSocket API for HTML5.
Looks fantastic, but as I am only now researching WebSocket possibilities for real-time financial updating, I would like to hear some recommendations, and pitfalls to avoid when planning out this architecture.
I'm looking at ASP.Net MVC, and possibly some WPF/Silverlight MVVM.
Are there other WebSocket API's that are better (and why), and some good examples?
Also, what kind of traffic can WebSockets handle? I mean, if we have over a million users on a system updating real-time, how do hardware requirements change because the software architecture implements WebSockets?
A late answer. Here is a WebSocket Server (framework) that is based on .NET and has support for modelbinding / controller and validations etc. in a way that reminds of MVC. It is very easy to get started using it. Just create a new MVC3 Project and type:
Install-Package XSockets
Using the Package Manager Console in Visual Studio
More info on http://xsockets.net
And yes, it supports RFC6455 and Hibi00 and has a fallback for "older" browsers.
I figured I'd come back at this, now that I have a solution ready for production. I took a look at a few vendors that basically charge a lot of money for something you can essentially build yourself. They all have good products, and if your time to market is critical, those prefab options may be the best in the short run.
After poking around with Node.JS with Socket.IO, I shifted my attention to SignalR - an asynchronous signaling library for .NET to help build real-time, multi-user interactive web applications, and used the hub implementation.
It manages all the heavy lifting and connection building with just a few lines of JavaScript, and automatically selects the appropriate transport protocol for the connection.
For a load-balanced environment, implementation of a caching server such as Redis is required.
Here's a C# implementation of a Web Socket client and server on CodeProject:
Web Socket Server
I think following links will help you..
The WebSockets prototype with Silverlight, HTML Bridges and JavaScript
Silverlight and WebSockets (Mike Taulty's blog)
https://github.com/Olivine-Labs/Alchemy-Websockets
Here's an open source websocket server and client library. C#/Javascript. Includes fallback to flash sockets for browsers that don't have websockets yet. Tested on most web browsers including mobile ones, works everywhere.
Realtime financials? I don't know how many connections you plan on handling but this one is also the most scalable solution available right now.
Although the number of browsers are quite limited for websockets, mobile browsers have support for that. But i would be considering the use of more cross browser friendly choices like PokeIn reverse ajax library

simple http server

I have a server client application.
The clients sends the server http posts with info every second or so.
The server is implemented using C#, there server doesn't need to respond in any way to the client.
Whats the easiest and most practical way to get this done? Is there some kind of library that is easy to use that I can import into my project.
Why not just use a regular old web service? It sounds like you have simple functionality that doesn't need to maintain a connection state. With a web service, you can simply expose the methods to your client, accessible via HTTP/S. If you're already using .NET for your client, you can simply add a web reference to your project and have .NET do the heavy lifting for you. There wouldn't be any need to reinvent the wheel.
You can use http.sys to create your own http listener without IIS or additional overhead. Aaron Skonnard has a good article here.
Because of certain limitations of uhttpsharp (specifically no support for POST forms and file uploads and it using threads to process requests), I've made NHttp available at github which supports full request parsing like ASP.net and processes requests using the asynchronous TCP model.

Web Chat Application - ASP.NET/Jabber/Ajax/WCF/Comet/ReverseAjax - Issues Faced - Seeking Insights

I've been trying to build a web based chat application for the past three weeks and i'm facing issues with whatever route (programming technique/technology) i take to build it. I've explained the issues i've experienced with all of'em below. Kindly provide whatever insights you have in this.
ASP.NET-AJAX
First issue is that it is Not Really Real Time
If client hits the chat server every x seconds (constant time stamp) it is not going to be real time unless x is very very less
If x is very small like 1 second and if there are 1000 users online at the same time i think it is really going to hammer the chat server and cause scalability/performance issues
WCF-Duplex
I unfortunately wasted considerable amount of time in this trying to build a WCF duplex service which maintains all the clients and invokes the client through the channel as and when required. But i recently learnt that WCF duplex callback wont work with ASP.NET (since http is request and respond type). I was following this great article to build a duplex service.
Comet/ReverseAjax/HTTP Server Push
I'm extremely new to this technique and wonder how well enough it can scale. After my first glance on this programming technique here in wiki and the very first article on Comet by Alex here, i learned that the client always maintains an open connection (long living ajax calls) to the server which can be used by the server to push "interesting events happening in the server" to the browser (client). So how well can it scale? What if the max no of open connections exceed in IIS or any other issues like that?
Jabber Server/Client (XMPP)
I see that most of the prominent chat applications that can be seen online are making use of Jabber. I also learned that writing a Jabber server from the scratch is a tedious task. I have separate user profile store for by application. Can i integrate that with Jabber easily? Any open source Jabber servers that i can host privately? (I've seen many open source tools to build the client easily)
Any insights provided are very much appreciated.
Thank you
NLV
If you are using .NET, check out WebSync. It allows for fully scalable comet using IIS to integrate directly with your application. There is a free Community edition you can try out, along with tons of examples and chat demos.
I just recently implemented a multi-client Jabber web-app using WebSync and jabber-net.
PokeIn provides shared objects among the clients and it simply helps you to create impressively solid and fast web applications. Even if your application is hosted on multiple servers, PokeIn manages the shared objects on all of them. So, this feature will help you to create quite effective solutions. In addition to these, you will find very useful samples over there
I know this is old but if somone new founds this you should consider using SignalR
Open Source Jabber Server
Have you checked out OpenFire

Categories

Resources