enhancementhelp wantedsublime-text
Repository metrics
- Stars
- (3,611 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Findings:
- There's no need to create a new WebSocket server for every connection
- WebSocket servers can live on the same connection as HTTP servers
Changes suggested:
- Have the HTTP server return a static response:
{ProtocolVersion: 1, WebSocketPort: 4001}(the port is still user-configurable) - Move the connection logic behind the WebSocket instead of the HTTP server, because in the future the browser extension will be able to skip the HTTP request
This change is backwards-compatible in editor extensions, it can already be seen in the new VS Code extension: https://github.com/fregante/GhostText-for-VSCode/blob/17a6d24f066aef98c2561b8690592c08e5c8c6ff/source/extension.ts#L120-L122
I think the ACME plugin has also been doing this for years: https://github.com/fhs/Ghost/blob/aaff3cd0ec26f69a7f6bc59e8a419fafa5d7aa6d/main.go#L80