Express work
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { applyWSSHandler } from "@trpc/server/adapters/ws"
|
||||
import { Effect, Layer } from "effect"
|
||||
import ws from "ws"
|
||||
import { Effect, Layer, Runtime } from "effect"
|
||||
import { WebSocketServer } from "ws"
|
||||
import { websocketPort } from "../config"
|
||||
import { TRPCContextCreator } from "../trpc/TRPCContextCreator"
|
||||
import { RPCRouter } from "./RPCRouter"
|
||||
@@ -9,7 +9,11 @@ import { RPCRouter } from "./RPCRouter"
|
||||
export module RPCWebSocketServer {
|
||||
export const Live = Layer.scopedDiscard(Effect.acquireRelease(
|
||||
Effect.gen(function*() {
|
||||
const wss = new ws.Server({ port: yield* websocketPort })
|
||||
const runSync = yield* Effect.runtime().pipe(
|
||||
Effect.map(Runtime.runSync)
|
||||
)
|
||||
|
||||
const wss = new WebSocketServer({ port: yield* websocketPort })
|
||||
|
||||
const handler = applyWSSHandler({
|
||||
wss,
|
||||
|
||||
Reference in New Issue
Block a user