Global configuration
- ∞ Pusher.hostString
-
This can be changed to point to alternative Channels URLs (used internally for our staging server or if you’d like to try out beta features).
- ∞ Pusher.channel_auth_endpointString
-
Endpoint on your server that will return the authentication signature needed for private and presence channels. Defaults to
'/pusher/auth'
.For more information see authenticating users.
** Note: ** If authentication fails a
subscription_error
event is triggered on the channel. For more information see handling authentication problems.
- ∞ Pusher.channel_auth_transportString
-
Defines how the authentication endpoint, defined using
Pusher.channel_auth_endpoint
, will be called. There are two options available:- ajax - The default option where an
XMLHttpRequest
object will be used to make a request. The parameters will be passed asPOST
parameters. - jsonp - The authentication endpoint will be called by a
{'<script>'}
tag being dynamically created pointing to the endpoint defined byPusher.channel_auth_endpoint
. This can be used when the authentication endpoint is on a different domain to the web application. The endpoint will therefore be requested as aGET
and parameters passed in the query string.
For more information see the Channel authentication transport section of the authenticating users docs.
- ajax - The default option where an
- ∞ Pusher.logFunction
-
By default we don’t log anything. If you want to debug your application and see what’s going on within Channels then you can assign a global logging function.
The Pusher.log value should be set with a function with the following signature:
function (message) {};
∞ Example
Pusher.log = (message) => {
if (window.console && window.console.log) {
window.console.log(message);
}
};