Skip to content

Commit

Permalink
feat: improve websocket server Adapter (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhudaDad414 authored Dec 1, 2023
1 parent f7f38d1 commit 0dde2da
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 308 deletions.
8 changes: 0 additions & 8 deletions docs/pages/application-structure/env-vars-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ export default async function () {
httpServer: customServer, // A custom HTTP server of your own.
adapter: "native", // Default. Can also be 'socket.io' or a reference to a custom adapter.
port: process.env.PORT,
},
client: {
auth: {
token: process.env.TOKEN
}
}
},
cluster: {
Expand Down Expand Up @@ -133,12 +128,9 @@ These configurations apply to Glee itself, rather than any specific protocol.
|Field|Description|
|--|--|
|ws.server|Websocket server-specific configurations|
|ws.client|Websocket client-specific configurations|
|ws.server.adapter| The Glee adapter to use for the WebSocket server. Defaults to a "native" WebSocket implementation. Other allowed values are `socket.io` (to use the [Socket.IO](https://socket.io/) Glee adapter) or a reference to a custom adapter.|
|ws.server.httpServer| A custom HTTP server of your own. E.g., an [Express](https://expressjs.com/en/4x/api.html) server or any object that implements the [http.Server](https://nodejs.org/api/http.html#http_class_http_server) interface. |
|ws.server.port| The port to use when binding the WebSocket server. This is useful when your server is behind a proxy and the port exposed for consumption is not the same as the port your application should be bound to. Defaults to the port specified in the selected AsyncAPI server.|
|ws.client.auth| Authentication variables for client|
|ws.client.auth.token| HTTP Authentication header|
#### Cluster
|Field|Description|
|--|--|
Expand Down
2 changes: 1 addition & 1 deletion examples/http-test/functions/receiveTrigger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default async function (event) {
export default async function () {
const server = 'httpbin.org'
return {
reply: [{
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class HttpAdapter extends Adapter {

if (!isValid) {
this._endRequest(400, "Bad Request", res)
const message = `Header validation failed: ${humanReadableError}. Please ensure that the headers match the expected format and types defined in the schema.`;
const message = `Header validation failed: ${humanReadableError}. Please ensure that the headers match the expected format and types defined in the schema.`
throw new Error(message)
}
}
Expand Down
Loading

0 comments on commit 0dde2da

Please sign in to comment.