Skip to content

Commit 5fdc0d2

Browse files
committed
fix(price-service/server): add max payload size
By default ws library has max payload size of 100 MiB but actually the biggest valid call is 20 KiB. This change sets the limit to 100 KiB to add more resilliency on the web socket. The biggest call size can increase when there are new symbols but this service is not going to live seeing the 5x current price feeds!
1 parent 4bfa1c3 commit 5fdc0d2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

package-lock.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

price_service/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-service-server",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Webservice for retrieving prices from the Pyth oracle.",
55
"private": "true",
66
"main": "index.js",

price_service/server/src/ws.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ export class WebSocketAPI {
215215
}
216216

217217
run(server: http.Server): WebSocketServer {
218-
const wss = new WebSocketServer({ server, path: "/ws" });
218+
const wss = new WebSocketServer({
219+
server,
220+
path: "/ws",
221+
maxPayload: 100 * 1024, // 100 KiB
222+
});
219223

220224
wss.on("connection", (ws: WebSocket, request: http.IncomingMessage) => {
221225
logger.info(

0 commit comments

Comments
 (0)