Skip to content

Add extensions to send and receive serialized data on a websocket #776

@Kaliumhexacyanoferrat

Description

@Kaliumhexacyanoferrat

As a developer of an app using web sockets, I would like to easily send and received serialized objects via a web socket connection.

Example

Add extensions similar to the string extension we have.

connection.WriteAsync<T>(object, format = new JsonFormat()); // re-uses ISerializationFormat, defaults to JSON

.OnMessage((c, m) => m.DeserializeAsync<T>());

Acceptance criteria

  • The functionality is directly implemented in the websocket module
  • The ISerializationFormat is used
  • If no format is specified, JSON is assumed
  • Functionality is implemented as extensions (compare with ConnectionTextExtensions)
  • The existing DataAsString extension is moved into an extension class (e.g. WebsocketFrameTextExtensions)
  • The feature is documented on the GenHTTP website
  • The feature is covered by acceptance tests

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions