Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need the WebSocket instance? It concerns me a bit that WebSocket instance has a broad interface. (e.g.
socket.send()
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't required for the original request. @antfu maybe we should add this param once we have a real use case? And once we go there, it could be a Payload object like the others so we could extend it in the future if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion either on having it or not. I was just thinking why not, since we have that information.
A few notes added to the consideration:
WebSocket
it's a web standard so I don't need to worry about the API been changedvite:ws
already indicates it's web socket. Later if we really find an alternative way of making the connection, those hooks won't be called so there will be no conflicts like the generalvite:connect
I don't expect this will be changed and won't add much maintenance interface to us.
I do see one downside is that ppl might start using it and mess it around to break Vite - and then send requests to support very niche usages. But that could happen everywhere and we need to prevent that for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points, I think we can talk about this in the next team meeting 👍🏼
I assume you also don't think it is a good idea to have a Payload object here.