Custom server events frame format

It would be great if ServerEventsFeature.CreateFrame were overridable to customize the format of the frames data property. Or perhaps the plugin could take the Accept request header into account to allow this?

Currently we split the frames data property value client-side and parse part of it as a JSON object. Ideally we’d like to interpret the entire value as a JSON object and just get the selector from a property.

What’s you opinion on this. Thanks!

You’re solution is fine, it’s not a customization we want to promote since it will break all our current and future Server Events client implementations.

Although you can already override what gets emitted by providing a custom impl for ServerEventsFeature.WriteEvent:

I understand the remark about customizations.

The thing with overriding WriteEvent is that the frame argument is already formatted as [selector] [message]". In our scenario overriding the method would only move the fix from client code to the server.

So just use your existing client solution. It’s an example of a feature that so far only you want and if any one else used it, it would break their existing Server Event Client libraries at runtime which they could waste hours trying to diagnoze, so it’s not a customization we’ll add, esp. given you already have a workaround.

1 Like