Skip to main content

Posts

Showing posts from January, 2016

Strongly typed SingalR on server and client end through TypeScript.

SignalR is a very flexible framework to create bidirectional communication between client and server. The general process that is followed won't allow to have strongly typed calls on the server and also in client code. We will look into how to make strongly typed calls on the server through interface and client end through TypeScript. SignalR - making strong type on server side code Since client-side methods are very dynamic in nature, so calling those from server side behaves similarly to allow any calls. SignalR Hubs are derived from Microsoft.AspNet.SignalR.Hub class, there is also a generic version available to follow typed items. Ex: The interface is the replication of possible calls that would be received on the client end and calling of client-side methods on server code. /// <summary> /// Client(JS) side chatting interface callbacks. /// </summary> public interface IChatHub { /// <summary> /// Gets the online users