zoukankan      html  css  js  c++  java
  • SignalR: The new old thing

    As you can see, this is my first blog posted in cnblog. If you find any mistake, don’t hesitate to tell me, I will buy you ice cream.

    Today I want to talk about SignalR, a .Net real time library provided by Asp.Net team, which is such an old concept that it has been around for over 10 years. But real time technology is relatively recently that we’ve started seeing them used (or advertised). I think it’s mainly because this tech has matured and become standardised.

    Warm up

    If this is the first time you heard of SignalR, you may want to get started with some tutorials about adding real-time functionality to a web/desktop application. It’s a good habit to code yourself while learning new things.

    Architecture

    After going through the samples, you can know how this is implemented, the architecture is really simple. All connections between clients and server side are full duplex. Clients can send messages to the server as they always do, server can also push notifications to a specific client. But clients won’t talk to each other. From this point of view, you may find the server code is more or less a router.

    The only question left for us is , what kind of message should we send?

    “There is one thousand Hamlet in one thousand reader’s eyes”. If you are building a online chat room like Jabbr, you’d like to send/receive encrypted texts and images. If you are developing an online game, the messages would be more complex. Anyway, it just depends on your needs.

    Platform and Protocol

    SignalR is supported under a variety of server and client configurations. Meanwhile, each transport option has a set of requirement of its own. Like WebSocket, SignalR supports this new technique, but it falls back to other compatible techniques for older browsers or clients gracefully.

    In server side, If you want to use WebSocket, Windows Server 2012 or Windows 8 is required. WebSocket can even be used on Windows Azure websites, as long as the site’s .NET framework version is set to 4.5 and WebSocket option is enabled.

    While in Client side, the situation may be more complex. It varies from Web Browser, Windows desktop applications, Silverlight application to mobile devices. Just as you can see below, SignalR may use Forever Frame, Server-Sent Events or Long Polling if WS is somehow not supported.

    protocol

    However, as a .NET developer, you will never be bothered which protocol to choose. You can even regard SignalR as a wrapper and do not care about the inner implementation. SignalR would decide which protocol is the best and switch to it.

    As SignalR supports multi platforms, it is such a relief to .NET developers that we don’t need to learn more libraries doing the same thing. A stable and easy-to-use library is enough. I even leverage SignalR in my personal Chrome Extension then I have a perfect real time logging module.

    For more information

    You can read its documentation for more details. As SignalR is open-source, you can follow its repo in github then read its source code directly. BTW, I have to say .NET is really powerful and I’m just a newbie to this fresh new world.

  • 相关阅读:
    VS2010/MFC编程入门之四十九(图形图像:CDC类及其屏幕绘图函数)
    VS2010/MFC编程入门之四十八(字体和文本输出:文本输出)
    VS2010/MFC编程入门之四十七(字体和文本输出:CFont字体类)
    VS2010/MFC编程入门之四十六(MFC常用类:MFC异常处理)
    VS2010/MFC编程入门之四十五(MFC常用类:CFile文件操作类)
    VS2010/MFC编程入门之四十四(MFC常用类:定时器Timer)
    VS2010/MFC编程入门之四十三(MFC常用类:CTime类和CTimeSpan类)
    spring cloud深入学习(二)-----服务注册中心spring cloud eureka
    spring cloud深入学习(一)-----什么是微服务?什么是rpc?spring cloud简介
    spring深入学习(六)-----springmvc
  • 原文地址:https://www.cnblogs.com/rebornix/p/3510497.html
Copyright © 2011-2022 走看看