How to add form-data to Laravel Echo request?
Is there any way to add form-data in a similar way?
The simple answer is - NO
Laravel Echo doesn't have the functionality to achieve that within the parameter set.
The reason we can see the Form Data
object in the Dev Tools requests, is because pusher-js is adding them before making the request to the server. To achieve that, we would have to manipulate the pusher API before the request is executed, but this goes off the original topic of this thread.
So if you want to send the data to the server, the easiest would be adding custom headers as pointed in the original question.
...
auth: {
headers: {
token: '123'
}
}
...