@based/server
Advanced tools
Comparing version 8.1.1 to 9.0.0
import type { BasedServer, ServerOptions } from '../server.js'; | ||
declare const _default: (server: BasedServer, { key, cert, port, ws: wsOptions, disableRest, disableWs }: ServerOptions) => void; | ||
declare const _default: (server: BasedServer, { key, cert, port, ws: wsOptions, disableRest, disableWs, }: ServerOptions) => void; | ||
export default _default; |
@@ -8,3 +8,3 @@ import uws from '@based/uws'; | ||
import { sendAndVerifyAuthMessage } from './ws/auth.js'; | ||
export default (server, { key, cert, port, ws: wsOptions = {}, disableRest, disableWs }) => { | ||
export default (server, { key, cert, port, ws: wsOptions = {}, disableRest, disableWs, }) => { | ||
const app = key && cert | ||
@@ -55,2 +55,4 @@ ? uws.SSLApp({ | ||
}; | ||
// allways | ||
ws.subscribe('reload'); | ||
session.ws = ws; | ||
@@ -57,0 +59,0 @@ session.c = ctx; |
@@ -25,2 +25,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
export declare const encodeChannelMessage: (id: number, buffer: Buffer) => Uint8Array; | ||
export declare const encodeReload: (type: number) => Uint8Array; | ||
export declare const decode: (buffer: Uint8Array) => any; |
@@ -270,2 +270,16 @@ import zlib from 'node:zlib'; | ||
}; | ||
export const encodeReload = (type) => { | ||
// Type 7.3 (fill data) | ||
// 0 = all | ||
// 1 = browser | ||
// 2 = non-browser | ||
// | 4 header | 1 subType | 1 type \ | ||
const msgSize = 6; | ||
const header = encodeHeader(7, false, msgSize); | ||
const array = new Uint8Array(4 + msgSize); | ||
storeUint8(array, header, 0, 4); | ||
storeUint8(array, 3, 4, 1); | ||
storeUint8(array, type, 5, 1); | ||
return array; | ||
}; | ||
export const decode = (buffer) => { | ||
@@ -272,0 +286,0 @@ const header = readUint8(buffer, 0, 4); |
@@ -107,2 +107,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
listenSocket: any; | ||
forceReload(type?: number): void; | ||
geo: (ctx: Context) => Promise<Geo>; | ||
@@ -109,0 +110,0 @@ getIp: GetIp; |
@@ -10,2 +10,3 @@ import { isClientContext, } from '@based/functions'; | ||
import util from 'node:util'; | ||
import { encodeReload } from './protocol.js'; | ||
/** | ||
@@ -58,2 +59,5 @@ Based server | ||
listenSocket; | ||
forceReload(type = 0) { | ||
this.uwsApp.publish('reload', encodeReload(type), true, false); | ||
} | ||
geo = async (ctx) => { | ||
@@ -60,0 +64,0 @@ if (!ctx.session) { |
{ | ||
"name": "@based/server", | ||
"version": "8.1.1", | ||
"version": "9.0.0", | ||
"license": "MIT", | ||
@@ -19,3 +19,3 @@ "main": "./dist/index.js", | ||
"utility-types": "^3.10.0", | ||
"@based/uws": "^4.1.0", | ||
"@based/uws": "^5.0.0", | ||
"@saulx/diff": "^2.0.2", | ||
@@ -22,0 +22,0 @@ "@saulx/hash": "^3.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
412850
5927
+ Added@based/uws@5.0.0(transitive)
- Removed@based/uws@4.1.0(transitive)
Updated@based/uws@^5.0.0