@ -19,11 +19,12 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ccms/nashorn": "^0.8.0",
|
||||
"@javatypes/tomcat-websocket-api": "^0.0.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.9.2"
|
||||
"typescript": "^3.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ccms/nashorn": "^0.8.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/// <reference types="@ccms/nashorn" />
|
||||
/// <reference types="@javatypes/tomcat-websocket-api" />
|
||||
|
||||
import { Server, ServerOptions } from './socket-io'
|
||||
|
||||
@ -6,40 +7,40 @@ interface SocketIOStatic {
|
||||
/**
|
||||
* Default Server constructor
|
||||
*/
|
||||
(): Server;
|
||||
(): Server
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param srv The HTTP server that we're going to bind to
|
||||
* @param opts An optional parameters object
|
||||
*/
|
||||
(srv: any, opts?: ServerOptions): Server;
|
||||
(srv: any, opts?: ServerOptions): Server
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param port A port to bind to, as a number, or a string
|
||||
* @param An optional parameters object
|
||||
*/
|
||||
(port: string | number, opts?: ServerOptions): Server;
|
||||
(port: string | number, opts?: ServerOptions): Server
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param A parameters object
|
||||
*/
|
||||
(opts: ServerOptions): Server;
|
||||
(opts: ServerOptions): Server
|
||||
|
||||
/**
|
||||
* Backwards compatibility
|
||||
* @see io().listen()
|
||||
*/
|
||||
listen?: SocketIOStatic;
|
||||
listen?: SocketIOStatic
|
||||
}
|
||||
|
||||
type SocketStatic = SocketIOStatic & { Instance?: symbol }
|
||||
|
||||
// @ts-ignore
|
||||
let io: SocketStatic = function (pipeline: any, options: ServerOptions) {
|
||||
return new Server(pipeline, options)
|
||||
return new Server(pipeline, options)
|
||||
}
|
||||
io.Instance = Symbol("@ccms/websocket")
|
||||
export default io
|
||||
|
@ -10,9 +10,7 @@ const WebSocketServerProxy = Java.type("pw.yumc.MiaoScript.websocket.WebSocketPr
|
||||
const ThreadPoolExecutor = Java.type('java.util.concurrent.ThreadPoolExecutor')
|
||||
const ThreadPoolTaskExecutor = Java.type('org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor')
|
||||
|
||||
interface TomcatWebSocketSession {
|
||||
getId: () => number
|
||||
}
|
||||
type TomcatWebSocketSession = javax.websocket.Session
|
||||
|
||||
class TomcatWebSocketServer extends EventEmitter {
|
||||
private beanFactory: any
|
||||
|
Reference in New Issue
Block a user