Skip to content

CupertinoWebSocket: Allow close codes as defined in RFC 6455 #1294

@kpsroka

Description

@kpsroka

This is a follow-up from issue #1203.

At this moment, the CupertinoWebSocket.close will throw if passed non-null code parameter that's not equal to 1000 or in [3000, 4999] range.

This is not in line with the RFC 6455 specification, that allows additional codes in range 1000-1010 for client use.

The WHATWG specification of the WebSocket close operation is less permissive, but since:

  • CupertinoWebSocket is not available for browser-based clients, browser-centric specifications should not apply,
  • CupertinoWebSocket wraps NSURLSessionWebSocketTask which allows RFC 6455 close codes, and
  • CupertinoWebSocket refers to RFC 6455 in comments,

I believe that it should permit all client-side codes permitted by RFC 6455.

I'm fine with providing a PR for applying this change.

Metadata

Metadata

Assignees

Labels

package:cupertino_httpIssues related to package:cupertino_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions