w
This commit is contained in:
@@ -66,7 +66,7 @@ async function runSSE() {
|
|||||||
const url = new URL(req.url || "/", `http://${req.headers.host}`);
|
const url = new URL(req.url || "/", `http://${req.headers.host}`);
|
||||||
|
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
const transport = new SSEServerTransport("/message", res);
|
const transport = new SSEServerTransport("/sse", res);
|
||||||
const server = buildServer();
|
const server = buildServer();
|
||||||
await server.connect(transport);
|
await server.connect(transport);
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ async function runSSE() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.method === "POST" && url.pathname === "/message") {
|
if (req.method === "POST" && url.pathname === "/sse") {
|
||||||
const sessionId = url.searchParams.get("sessionId") || "";
|
const sessionId = url.searchParams.get("sessionId") || "";
|
||||||
const transport = transports.get(sessionId);
|
const transport = transports.get(sessionId);
|
||||||
if (!transport) {
|
if (!transport) {
|
||||||
|
|||||||
Reference in New Issue
Block a user