@alipay/faas-biz-server-sdk
Advanced tools
Comparing version 1.1.1-alpha.3 to 1.1.1-alpha.4
@@ -1,5 +0,4 @@ | ||
import { StorageOptions, WebSocketEvent } from "../../types/Websocket"; | ||
import { StorageOptions } from "../../types/Websocket"; | ||
import Chain from "./Chain"; | ||
import { Room } from "./Room"; | ||
import FaasWebSocket from "./Websocket"; | ||
export default class FaasWebSocketIO extends Chain { | ||
@@ -15,5 +14,4 @@ private ws; | ||
expect(roomId: string): this; | ||
on(event: WebSocketEvent, handler: (socket: FaasWebSocket) => void): void; | ||
emit(event: string, data: any): this; | ||
broadcast(roomId: string, event: string, data: any): this; | ||
} |
@@ -11,3 +11,2 @@ "use strict"; | ||
const RedisStorage_1 = __importDefault(require("./Storage/RedisStorage")); | ||
const Websocket_2 = __importDefault(require("./Websocket")); | ||
class FaasWebSocketIO extends Chain_1.default { | ||
@@ -58,13 +57,2 @@ ws; | ||
} | ||
on(event, handler) { | ||
addEventListener(`websocket:${event}`, (event) => { | ||
event.handle((async () => { | ||
const socket = new Websocket_2.default({ | ||
connectionId: event.connectionId, | ||
}); | ||
socket.storage = this._storage; | ||
handler(socket); | ||
})()); | ||
}); | ||
} | ||
emit(event, data) { | ||
@@ -71,0 +59,0 @@ this.later(async () => { |
@@ -8,2 +8,3 @@ import WS from '@alipay/faas-server-sdk/lib/Websocket'; | ||
storageOptions?: StorageOptions; | ||
payload?: any; | ||
} | ||
@@ -15,2 +16,3 @@ export default class FaasWebSocket extends Chain { | ||
properties: Map<string, any>; | ||
payload: any; | ||
constructor(options: WebSocketOptions); | ||
@@ -17,0 +19,0 @@ private initStorage; |
@@ -16,2 +16,3 @@ "use strict"; | ||
properties = new Map(); | ||
payload; | ||
constructor(options) { | ||
@@ -18,0 +19,0 @@ super(); |
{ | ||
"name": "@alipay/faas-biz-server-sdk", | ||
"version": "1.1.1-alpha.3", | ||
"version": "1.1.1-alpha.4", | ||
"description": "支付宝云开发业务 SDK(函数端)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
155955
3519