Skip to content

feat: add a server type that carries the smocket-only API - #188

Merged
electrohyun merged 2 commits into
mainfrom
feat/smocket-server-type
Aug 7, 2026
Merged

feat: add a server type that carries the smocket-only API#188
electrohyun merged 2 commits into
mainfrom
feat/smocket-server-type

Conversation

@electrohyun

Copy link
Copy Markdown
Owner

Summary

differences.md section B documents server.nextConnection(namespace) and io.adapter(factory) as public API, but annotating with ServerContract drops both, so following the documentation and following the exported types pointed in different directions.

const io: ServerContract = new Server('http://localhost:3000');
io.adapter(factory); // compile error before this change

ServerContract is not widened. It is the subset real socket.io is verified against, and the Ensure<> proofs stop compiling the moment it names a member socket.io lacks. SmocketServer extends ServerContract adds the two from outside instead, and gets no Ensure<> line of its own because there is nothing on socket.io's side to prove it against.

Server now declares implements SmocketServer, so the interface is checked against the class rather than trusted to stay in step. Both members already existed on the class with these signatures (adapter(factory: AdapterFactory): void, nextConnection(namespace = '/')), so no runtime code moved.

DelayingAdapter is left alone. It is exported as a class, so its name already works in type position, and it is an adapter rather than part of the server surface. The exports map is untouched.

Purely additive, so existing ServerContract annotations keep compiling. Under 0019 that is the public type change row, a minor above 1.0.0 and a patch below it.

Related issue

No tracking issue. Found while installing the package from outside and annotating a server with the types #178 exported.

Checklist

  • Tests added or updated. src/index.test.ts annotates a server as SmocketServer and calls both members, so the test stops compiling if either is lost. The conformance report is regenerated in its own commit.
  • Behavior verified against real socket.io. Both dual-run targets are green at 176, and the six Ensure<> proofs still hold, which is what confirms ServerContract stayed a socket.io subset.

@electrohyun electrohyun self-assigned this Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@electrohyun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 43543406-02ee-41b1-87de-a78ca3d6c861

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6e012 and 0fd109b.

📒 Files selected for processing (5)
  • docs/conformance.md
  • src/contract.ts
  • src/index.test.ts
  • src/index.ts
  • src/mock-server.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 7, 2026
@electrohyun
electrohyun merged commit bea0eea into main Aug 7, 2026
15 checks passed
@electrohyun
electrohyun deleted the feat/smocket-server-type branch August 7, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant