Remove or clause for sessionId where "none" is offered as an alternative.
In the first case (line 16) we already know that req.query.sessionId is set to something. I n the second (line 40), it doesn't matter because if it doesn't map to a transport no further action is taken.
This commit is contained in:
parent
d297c51f5e
commit
2da9f33969
1 changed files with 2 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ app.get("/sse", async (req, res) => {
|
||||||
const { server, cleanup } = createServer();
|
const { server, cleanup } = createServer();
|
||||||
|
|
||||||
if (req?.query?.sessionId) {
|
if (req?.query?.sessionId) {
|
||||||
const sessionId = (req?.query?.sessionId as string) || "none";
|
const sessionId = (req?.query?.sessionId as string);
|
||||||
transport = transports.get(sessionId) as SSEServerTransport;
|
transport = transports.get(sessionId) as SSEServerTransport;
|
||||||
console.error("Client Reconnecting? This shouldn't happen; when client has a sessionId, GET /sse should not be called again.", transport.sessionId);
|
console.error("Client Reconnecting? This shouldn't happen; when client has a sessionId, GET /sse should not be called again.", transport.sessionId);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -37,7 +37,7 @@ app.get("/sse", async (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/message", async (req, res) => {
|
app.post("/message", async (req, res) => {
|
||||||
const sessionId = (req?.query?.sessionId as string) || "none";
|
const sessionId = (req?.query?.sessionId as string);
|
||||||
const transport = transports.get(sessionId);
|
const transport = transports.get(sessionId);
|
||||||
if (transport) {
|
if (transport) {
|
||||||
console.error("Client Message from", sessionId);
|
console.error("Client Message from", sessionId);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue