Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
Joel edited this page Aug 3, 2016 · 1 revision

pogobuf.Client Events

The Client class is an EventEmitter that emits the following events (mostly for debugging purposes):

request(requestData)

Fires while building a RPC request envelope with subrequests.

Example requestData structure:

{
    request_id: 8145806132888207000,
    requests: [
        {
            name: 'Get Inventory',
            type: 4,
            data: {
                last_timestamp_ms: 0
            }
        }
    ]
}

raw-request(envelopeData)

Fires after building an RPC request envelope, just before it is encoded into a protobuf RequestEnvelope.

response(responseData)

Fires after receiving and successfully decoding an RPC request, just before the Promise is resolved.

Example responseData structure:

{
    status_code: 1,
    request_id: '8145806132888207360',
    responses: [
        {
            name: 'Get Inventory',
            type: 4,
            data: {
                /* inventory data */
            }
        }
    ]
}

endpoint-response(responseData)

Fires after the initial RPC response (including the URL of the endpoint to use for all further requests) has been received and decoded.

Example responeData structure:

{
    status_code: 53,
    request_id: '8145806132888207360',
    api_url: 'pgorelease.nianticlabs.com/plfe/403'
}

raw-response(responseEnvelope)

Fires when a RPC ResponseEnvelope has been received, just after it has been decoded.

parse-envelope-error(rawEnvelopeBuffer, error)

Fires when the RequestEnvelope structure could not be parsed (possibly due to erroneous .proto files). Can be used to dump out the raw protobuf response and debug using protoc.

parse-response-error(rawResponseBuffer, error)

Fires when one of the response messages received in an RPC response envelope could not be parsed (possibly due to erroneous .proto files). Can be used to dump out the raw protobuf response and debug using protoc.