Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: uwebsockets.js support #4095

Closed
wants to merge 1 commit into from
Closed

Conversation

yovanoc
Copy link
Contributor

@yovanoc yovanoc commented Mar 27, 2023

🎯 Changes

Support using uWebsockets.js.

Usage:

import { createUWebSocketsHandler } from '@trpc/server/adapters/uwebsockets/http';
import { applyWSSHandler } from '@trpc/server/adapters/uwebsockets/ws';
import { app } from '../config.js';
import { appRouter } from './root.js';
import { createContextHttp, createContextWS } from './context.js';

createUWebSocketsHandler(app, '/trpc', {
  router: appRouter,
  createContext: createContextHttp,
});

export const { broadcastReconnectNotification } = applyWSSHandler({
  app,
  prefix: '/trpc',
  router: appRouter,
  createContext: createContextWS,
});

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@vercel
Copy link

vercel bot commented Mar 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
www ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 27, 2023 at 5:49PM (UTC)

@vercel
Copy link

vercel bot commented Mar 27, 2023

@yovanoc is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@sachinraja
Copy link
Member

I don't think we can add this to code because of the maintenance burden and I don't think any of us on the core team are familiar with uwebsockets.

This is great work though and I would encourage you to publish this as a separate package!

@sachinraja sachinraja closed this Mar 29, 2023
@yovanoc
Copy link
Contributor Author

yovanoc commented Mar 29, 2023

I don't think we can add this to code because of the maintenance burden and I don't think any of us on the core team are familiar with uwebsockets.

This is great work though and I would encourage you to publish this as a separate package!

Oh ok, no problems but I can't because some files are not exported..or I have to copy paste a lot from internals...is there a way to export it then ? thanks

@juliusmarminge
Copy link
Member

I don't think we can add this to code because of the maintenance burden and I don't think any of us on the core team are familiar with uwebsockets.

This is great work though and I would encourage you to publish this as a separate package!

Oh ok, no problems but I can't because some files are not exported..or I have to copy paste a lot from internals...is there a way to export it then ? thanks

Make a PR exporting what you need 👍

@yovanoc
Copy link
Contributor Author

yovanoc commented Mar 29, 2023

Perfect, thank you a lot I do this today :)

@yovanoc yovanoc mentioned this pull request Mar 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants