gun:await - Wait for a response
Wait for a response.
This function waits for a message from the given stream and returns it as a tuple. An error will be returned should the process fail or a relevant message is not received within the specified duration.
The pid of the Gun connection process.
Identifier of the stream for the original request.
How long to wait for a message, in milliseconds.
Monitor for the Gun connection process.
A monitor is automatically created for the duration of this call when one is not provided.
A number of different tuples can be returned. They correspond to the message of the same name and they contain the same elements minus the pid and stream reference. Error tuples may also be returned when a timeout or an error occur.
Because the messages and returned tuples are equivalent, please refer to the manual pages for each message for further information:
gun_push(3) - Server-initiated push
gun_inform(3) - Informational response
gun_response(3) - Response
gun_data(3) - Response body
gun_trailers(3) - Response trailers
1.0: Function introduced.