I am facing issue when I'm connecting pusher with Laravel server.
Error : Pushers: State changed from com.pusher.client.AuthorizationFailureException: java.io.FileNotFoundException: https://url/auth
Here is my code ->
Gradle : implementation 'com.pusher:pusher-java-client:2.2.5'
fun Pusher(){
header?.put("Authorization", "Bearer token");
header?.put("Accept", "application/json");
header?.put("Content-Type", "application/x-www-form-urlencoded");
val authorizer = HttpAuthorizer("http://url/chat/auth")
authorizer.setHeaders(header)
val options = PusherOptions()
options.setCluster("key_cluster");
options.setHost("url.com")
options.setWssPort(6001)
options.setWsPort(6001)
options.setEncrypted(true)
options.authorizer=authorizer
pusher = Pusher("key", options)
pusher?.connect(object : ConnectionEventListener {
override fun onConnectionStateChange(change: ConnectionStateChange) {
if (change.getCurrentState() == ConnectionState.CONNECTED) {
subscribeToChannel();
}
Log.i("Pusher", "State changed from ${change.previousState} to ${change.currentState}")
}
override fun onError(
message: String?,
code: String?,
e: Exception?
) {
}
}, ConnectionState.ALL)
}
fun subscribeToChannel() {
channel = pusher!!.subscribePrivate("private-conect", object : PrivateChannelEventListener {
override fun onEvent(event: PusherEvent?) {
}
override fun onAuthenticationFailure(s: String, e: java.lang.Exception) {
}
})
}