Skip to content

trpc/examples-next-sse-chat

Repository files navigation

tRPC + Server-sent Events (SSE)

This example showcases the use of httpSubscriptionLink to facilitate .useSubscription via Server-sent Events.

Try demo http://sse.trpc.io/

Code

This project includes 2 examples of the subscription pattern:

  1. Simple example of whoIsTyping
  2. A slightly more involved example of livePosts

Features

  • 🧙‍♂️ E2E type safety with tRPC
  • ⚡ Full-stack React with Next.js
  • ⚡ Server-Sent-Events / Subscription support
  • ⚡ Database with Drizzle
  • 🔐 Authorization using next-auth