Skip to content

feat: implement the internal ws runtime #580

Closed

Description

@electrohyun

Problem

#538 needs an internal runtime before the public smocket/ws entry points can be connected. Implement the basic connection, text messaging, and normal-close behavior independently of package binding.

Proposed API

The internal constructors should support handlers such as:

server.on('connection', (socket) => {
  socket.on('message', (data) => socket.send(data.toString()));
});

client.onopen = () => client.send('hello');
client.onmessage = () => client.close();

Socket.IO behavior

Keep existing Socket.IO behavior unchanged. Use real ws as the reference for the selected application-visible behavior in ADR 0044 and run the same comparison cases against both implementations.

Scope check

  • This is not reconnection, transport fallback, heartbeat, Redis multi-server, or binary encoding

Tasks

  • Add isolated virtual server registration, asynchronous connection, text exchange, normal close, and registration cleanup without creating HTTP/TCP connections.
  • Support host/port/path matching, local host aliases, port: 0, address(), and the separate constructor callback receiver's this.address().
  • Supply basic request.url, request.method, and automatic request.headers on connection.
  • Support the selected EventEmitter methods, event handler properties, event listeners, and URL/close argument validation, with runtime and type comparisons.
  • Verify repeated connection/close cycles and preserve the existing Socket.IO tests.

This is the internal-runtime sub-issue of #538. Public entry points and generated package declarations remain in #562; client tracking and application examples in #539; byte inputs, send callbacks, and detailed failure/concurrent-close behavior in #540; shared-core extraction in #541.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions