Skip to content

Commit 5d3bfef

Browse files
authored
Fix the ssample error that append hey makes json datatype invalid (#865)
1 parent a9cc362 commit 5d3bfef

File tree

1 file changed

+5
-2
lines changed
  • tools/awps-tunnel/server/samples/upstream

1 file changed

+5
-2
lines changed

tools/awps-tunnel/server/samples/upstream/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ const handler = new WebPubSubEventHandler("chat", {
1111
},
1212
handleUserEvent: (req, res) => {
1313
console.log(JSON.stringify(req));
14-
res.success("Hey " + req.data, req.dataType);
14+
res.success(JSON.stringify(req.data), req.dataType);
1515
},
1616
});
1717

1818
const app = express();
19-
19+
app.use((req, res, next)=>{
20+
console.log(`${req.method} ${req.url}`);
21+
next();
22+
})
2023
app.use(handler.getMiddleware());
2124

2225
app.listen(3000, () => console.log(`Azure WebPubSub Upstream ready at http://localhost:3000${handler.path}`));

0 commit comments

Comments
 (0)