JSDoc: Namespace: websocket

# Namespace: websocket

## websocket

Manage the WebSocket communication channel. This channel is much faster and responsive, and it's used automatically if the browser supports WebSockets AND beef.http.websocket.enable = true.

Source:
  - websocket.js, line 8

### Methods

#### (static) alive()

Polling mechanism, to notify the BeEF server that the browser is still hooked, and the WebSocket channel still alive. todo: there is probably a more efficient way to do this. Double-check WebSocket API.

Source:
  - websocket.js, line 86

#### (static) init()

Initialize the WebSocket client object. Note: use WebSocketSecure only if the hooked origin is under https. Mixed-content in WS is quite different from a non-WS context.

Source:
  - websocket.js, line 26

#### (static) send()

Send data back to BeEF. This is basically the same as beef.net.send, but doesn't queue commands. Example usage: beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid + '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) + '","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }');

Source:
  - websocket.js, line 75

#### (static) start()

Send Hello message to the BeEF server and start async polling.

Source:
  - websocket.js, line 48