| 152 | |
| 153 | |
| 154 | class SocketRuntimeClient extends RuntimeClient { |
| 155 | socket: WebSocket; |
| 156 | |
| 157 | constructor(socket:WebSocket, withIDE:boolean) { |
| 158 | const dbs = { |
| 159 | "http": new HttpDatabase(), |
| 160 | "shared": shared, |
| 161 | } |
| 162 | if(withIDE) { |
| 163 | dbs["view"] = new BrowserViewDatabase(); |
| 164 | dbs["editor"] = new BrowserEditorDatabase(); |
| 165 | dbs["inspector"] = new BrowserInspectorDatabase(); |
| 166 | } |
| 167 | super(dbs); |
| 168 | this.socket = socket; |
| 169 | } |
| 170 | |
| 171 | send(json) { |
| 172 | if(this.socket && this.socket.readyState === 1) { |
| 173 | this.socket.send(json); |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | function IDEMessageHandler(client:SocketRuntimeClient, message) { |
| 179 | let ws = client.socket; |
nothing calls this directly
no outgoing calls
no test coverage detected