Class

Server

Server(port)

This class is a socket.io server which will listen for browser connections whith the atrica-extension plugin and will create a socket through which the worker can communicate with the browser.

Constructor

new Server(port)

Create a WorkerServer instance

Parameters:
Name Type Default Description
port number 3000

The port on which the socket.io server should listen. If the port is busy, then will try port + 1, then port + 2, etc...

View Source puppeteer/server.js, line 18

Members

SocketIoServer

server

socket.io server

View Source puppeteer/server.js, line 27

Methods

browserConnection(browserId) → {Promise.<Socket>}

Returns a promise resolved when the browser with browserId connects to the server. The promise returns a socket toward the browser once resolved.

Parameters:
Name Type Description
browserId number

The ID of the browser to await

View Source puppeteer/server.js, line 62

  • Promise for the socket toward the browser
Promise.<Socket>

getPort() → {number}

View Source puppeteer/server.js, line 52

  • The port where the socket.io server is running
number

async run(listeneropt) → {Promise}

Start the socket.io server

Parameters:
Name Type Attributes Description
listener function <optional>

Function executed for listening. Mostly usefull for printing messages when server start

View Source puppeteer/server.js, line 37

Promise