JavaScript and TypeScript clients for SignalR for ASP.NET Core and Azure SignalR Service
## Installation
```bash
npm install @microsoft/signalr
# or
yarn add @microsoft/signalr
```
To try previews of the next version, use the `next` tag on NPM:
```bash
npm install @microsoft/signalr@next
# or
yarn add @microsoft/signalr@next
```
## Usage
See the [SignalR Documentation](https://docs.microsoft.com/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. [API Reference Documentation](https://docs.microsoft.com/javascript/api/%40aspnet/signalr/?view=signalr-js-latest) is also available on docs.microsoft.com.
For documentation on using this client with Azure SignalR Service and Azure Functions, see the [SignalR Service serverless developer guide](https://docs.microsoft.com/azure/azure-signalr/signalr-concept-serverless-development-config).
### Browser
To use the client in a browser, copy `*.js` files from the `dist/browser` folder to your script folder include on your page using the `<script>` tag.
### WebWorker
To use the client in a webworker, copy `*.js` files from the `dist/webworker` folder to your script folder include on your webworker using the `importScripts` function. Note that webworker SignalR hub connection supports only absolute path to a SignalR hub.
### Node.js
To use the client in a NodeJS application, install the package to your `node_modules` folder and use `require('@microsoft/signalr')` to load the module. The object returned by `require('@microsoft/signalr')` has the same members as the global `signalR` object (when used in a browser).
### Example (Browser)
```javascript
let connection = new signalR.HubConnectionBuilder()
.withUrl("/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
### Example (WebWorker)
```javascript
importScripts('signalr.js');
let connection = new signalR.HubConnectionBuilder()
.withUrl("https://example.com/signalr/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
### Example (NodeJS)
```javascript
const signalR = require("@microsoft/signalr");
let connection = new signalR.HubConnectionBuilder()
.withUrl("/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
没有合适的资源?快使用搜索试试~ 我知道了~
ASP.NET Core SignalR,完善善版本
共305个文件
js:78个
map:75个
ts:60个
需积分: 5 4 下载量 94 浏览量
2022-04-24
16:27:48
上传
评论
收藏 1.75MB ZIP 举报
温馨提示
ASP.NET Core SignalR 官网: https://docs.microsoft.com/zh-cn/aspnet/core/signalr/introduction?view=aspnetcore-5.0
资源详情
资源评论
资源推荐
收起资源包目录
ASP.NET Core SignalR,完善善版本 (305个子文件)
SignalRTest.TagHelpers.output.cache 362KB
SignalRTest.csproj.AssemblyReference.cache 167KB
project.nuget.cache 283B
SignalRTest.assets.cache 140B
SignalRTest.csproj.CoreCompileInputs.cache 42B
SignalRTest.genruntimeconfig.cache 42B
SignalRTest.AssemblyInfoInputs.cache 42B
SignalRTest.RazorAssemblyInfo.cache 42B
SignalRTest.RazorCoreGenerate.cache 42B
SignalRTest.RazorTargetAssemblyInfo.cache 42B
SignalRTest.MvcApplicationPartsAssemblyInfo.cache 0B
SignalRTest.StaticWebAssets.Manifest.cache 0B
SignalRTest.TagHelpers.input.cache 0B
applicationhost.config 79KB
SignalRTest.csproj.CopyComplete 0B
_Layout.cshtml.g.cs 24KB
Index.cshtml.g.cs 7KB
_ValidationScriptsPartial.cshtml.g.cs 7KB
Error.cshtml.g.cs 4KB
Privacy.cshtml.g.cs 3KB
_ViewStart.cshtml.g.cs 3KB
_ViewImports.cshtml.g.cs 2KB
Startup.cs 2KB
ChatHub.cs 1KB
SendController.cs 1KB
SignalRTest.RazorTargetAssemblyInfo.cs 1KB
SignalRTest.AssemblyInfo.cs 1016B
Error.cshtml.cs 873B
Program.cs 719B
SignalRTest.RazorAssemblyInfo.cs 619B
Privacy.cshtml.cs 536B
Index.cshtml.cs 530B
.NETCoreApp,Version=v5.0.AssemblyAttributes.cs 190B
_Layout.cshtml 2KB
Error.cshtml 882B
Index.cshtml 854B
_ValidationScriptsPartial.cshtml 176B
Privacy.cshtml 172B
_ViewImports.cshtml 104B
_ViewStart.cshtml 35B
SignalRTest.csproj 695B
bootstrap.css 198KB
bootstrap.min.css 152KB
bootstrap-grid.css 67KB
bootstrap-grid.min.css 47KB
bootstrap-reboot.css 5KB
bootstrap-reboot.min.css 4KB
site.css 1KB
SignalRTest.Views.dll 42KB
SignalRTest.Views.dll 42KB
SignalRTest.dll 14KB
SignalRTest.dll 14KB
SignalRTest.dll 10KB
SignalRTest.dll 10KB
SignalRTest.GeneratedMSBuildEditorConfig.editorconfig 460B
SignalRTest.exe 123KB
apphost.exe 123KB
WebSocketTest.html 3KB
favicon.ico 5KB
jquery.js 281KB
bootstrap.bundle.js 225KB
signalr.js 136KB
signalr.js 136KB
bootstrap.js 133KB
jquery.min.js 87KB
bootstrap.bundle.min.js 77KB
bootstrap.min.js 57KB
jquery.validate.js 48KB
additional-methods.js 42KB
signalr.min.js 41KB
signalr.min.js 41KB
HubConnection.js 40KB
HubConnection.js 40KB
HttpConnection.js 28KB
HttpConnection.js 28KB
jquery.validate.min.js 23KB
jquery.validate.unobtrusive.js 19KB
additional-methods.min.js 18KB
LongPollingTransport.js 10KB
LongPollingTransport.js 9KB
Utils.js 9KB
Utils.js 8KB
WebSocketTransport.js 7KB
WebSocketTransport.js 7KB
Errors.js 6KB
Errors.js 6KB
jquery.validate.unobtrusive.min.js 6KB
FetchHttpClient.js 6KB
FetchHttpClient.js 6KB
HubConnectionBuilder.js 5KB
ServerSentEventsTransport.js 5KB
HubConnectionBuilder.js 5KB
JsonHubProtocol.js 5KB
ServerSentEventsTransport.js 5KB
JsonHubProtocol.js 4KB
index.js 3KB
XhrHttpClient.js 3KB
XhrHttpClient.js 3KB
HandshakeProtocol.js 3KB
HandshakeProtocol.js 3KB
共 305 条
- 1
- 2
- 3
- 4
智慧方
- 粉丝: 302
- 资源: 66
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 笔记实验六,spark,大数据分析
- ####蓝桥杯python的详细的信息介绍
- 电子万年历软件仿真(经过多次修改,保证正确性)
- Unity XR 手势射击控制脚本(适用于任何可手势识别的设备)
- 机械设计全自动电表(NB和IC卡表)控制和上壳装配线sw16可编辑非常好的设计图纸100%好用.zip
- 基于matlab的EAN-13条形码识别系统GUI界面.zip代码53
- matlab基于bp神经网络交通信号标志识别GUI界面13个标志.zip代码54
- 电子万年历答辩实物展示视频mp4格式
- 基于python实现的程序,包括哈希感知算法cvHash,图像切割cvsplit,固定目标检测cvRec(附文档ppt)等
- 计算0-10000之间所有偶数的和
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0