RFC6455-The WebSocket protocol 之三:WebSocket URIs

2024-09-02 05:18

本文主要是介绍RFC6455-The WebSocket protocol 之三:WebSocket URIs,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

3.WebSocket URIs


This specification defines two URI schemes, using the ABNF syntax
defined in RFC 5234 [RFC5234], and terminology and ABNF productions
defined by the URI specification RFC 3986 [RFC3986].

本说明书定义了两种格式的URI,一种是[RFC5234]定义的ABNF ,一种是 [RFC3986]中定义的术语和ABNF。


ws-URI = "ws:" "//" host [ ":" port ] path [ "?" query ]
wss-URI = "wss:" "//" host [ ":" port ] path [ "?" query ]

// 对上面格式的说明
host = <host, defined in [RFC3986], Section 3.2.2>
port = <port, defined in [RFC3986], Section 3.2.3>
path = <path-abempty, defined in [RFC3986], Section 3.3>
query = <query, defined in [RFC3986], Section 3.4>


The port component is OPTIONAL; the default for "ws" is port 80,
while the default for "wss" is port 443.

端口选项是可选的;“ws”的默认端口是80,“wss”的默认端口是443.


The URI is called "secure" (and it is said that "the secure flag is
set") if the scheme component matches "wss" case-insensitively.

假如URI与“wss”匹配(不区分大小写),该URI就被称之为“安全的”(并且被称之为“安全标记已经设置”)


The "resource-name" (also known as /resource name/ in Section 4.1)
can be constructed by concatenating the following:
o "/" if the path component is empty
o the path component
o "?" if the query component is non-empty
o the query component

“资源名”(同4.1节中的/资源名/)由以下部分组成:

  • "/" 当路径为空的情况使用。
  • 路径。
  • "?" 当查询参数不为空使用。
  • 查询参数。


Fragment identifiers are meaningless in the context of WebSocket URIs
and MUST NOT be used on these URIs. As with any URI scheme, the
character "#", when not indicating the start of a fragment, MUST be
escaped as %23.

在websocket的URI中,片段标识符是没有含义的而且不应该被使用。就像其它URI一样,当“#”不代表片段的开始时,必须转换成“%23”。


这篇关于RFC6455-The WebSocket protocol 之三:WebSocket URIs的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1129093

相关文章

Java Websocket实例【服务端与客户端实现全双工通讯】

Java Websocket实例【服务端与客户端实现全双工通讯】 现很多网站为了实现即时通讯,所用的技术都是轮询(polling)。轮询是在特定的的时间间隔(如每1秒),由浏览器对服务器发 出HTTP request,然后由服务器返回最新的数据给客服端的浏览器。这种传统的HTTP request 的模式带来很明显的缺点 – 浏 览器需要不断的向服务器发出请求,然而HTTP

springboot websocket 服务端

在Spring Boot中使用WebSocket实现服务端和Java客户端的实时通信,可以分为几个步骤来完成。这里将详细介绍服务端和Java客户端的具体实现。 服务端设置 添加依赖: 在pom.xml文件中添加Spring WebSocket的依赖。 <dependency><groupId>org.springframework.boot</groupId><artifactId>spr

Spring boot 项目作为客户端调用 服务端websocket

文章目录 java客户端请求websocketSpring boot 导入包客户端调用方法测试执行方法connectWebSocketHandshakeMessagesendHandshakeWebSocketConfig.queue.take方法对应实体类配置 yaml 资源WebSocketConfig 配置类注入配置websocketUrl:LinkedBlockingQueueLin

WebSocket+Spring boot 构建一个完整消息服务

1、添加依赖 compile project(":faas-spring-boot-starter-data-websocket") 2、定义WebSocketHandler Socket 服务入口(Header接收 jwt-token 同应用登录的Token(直接解决鉴权问题),然后定义请求的自定义参数,方便后续消息推送、支持群发、私发、模糊匹配) @Component@WebSock

spring-websocket基于stomp实现websocket

目录 概述 后端代码 拦截器 HandshakeInterceptor拦截器 ChannelInterceptor拦截器   消息转换器  配置类  消息处理 广播模式   用户模式 自定义请求头 用户信息  ChannelInterceptor拦截器设置用户信息  DefaultHandshakeHandler的继承类中设置用户对象 前端代码 概述

Nodejs 串口通信 : websocket , serialport

最近在学习如何实现web页面和串口间通信,网页请求使用websocket,实现的基本功能如下: 1、基本需求:硬件:有两个信号灯(TLA-505-1T),一个485继电器(开关),电压转换器,工业触屏一体机。 2、原理图:                  3工作原理: 首先一体机中采用node开发服务器,网页请求采用websocket协议,直接放代码了: var express

nodejs websocket

express-ws是express的一个中间件,借助其我们可以在express中实现websocket的功能。 其github地址为:git@github.com:Sirchongxue/nodejs-websocket.git 通过npm install express-ws可以安装。 var express = require('express'); var express = r

netty和websocket的区别

区别 简单来说,Netty 是框架,WebSocket 是协议,Netty 可以用于实现 WebSocket 服务。 1. 概念 Netty:Netty 是一个网络应用框架,旨在帮助开发者简化网络通信的实现。它可以处理多种协议(如 TCP、UDP、HTTP 等),并提供异步事件驱动的编程模型。Netty 是更底层的框架,主要用于构建高性能、高并发的网络服务器和客户端。 WebSocket

搭建SpringBoot+ Netty + WebSocket 通信协议框架

运用场景:与机器设备进行通讯或者其他场景; pom文件就不上传了,直接上代码,网上都可以找的到 主要是 SpringBoot 和 Netty 的依赖 1.配置类 @Component@ConfigurationProperties(prefix = "ws")public class WebSocketConfig {private int port;private String host

Netty+Websocket 初入理解

Netty+Websocket 笔记 初入理解Netty+Websocket,需要了解其中的类和方法有什么作用,以下是自己总结的一些自己用到的: Channel 通信通道,代表一个socket链接 ChannelFuture 执行异步操作 ChannelPipeline 管道:每个Channel都有关联的ChannelPipeline,提供handler链的容器 Chann