Mattia
Mattia

Reputation: 2281

How to generate a websocket error

I am writing a library that has server and client components that use websockets as the transport. I'm testing on a variety of browsers and need to test some behaviors tied to errors and the sockets unexpectedly closing.

Is there a way to cause an error in the websocket (aside from trying to connect to an invalid url/non-websocket server)?

NOTE: I am not unit testing. I need to test how clients interact with servers, within different browsers, so mocking the websockets is not an option.

Upvotes: 1

Views: 1178

Answers (1)

AirCal86
AirCal86

Reputation: 126

You could either close the connection from the server side (in a non-graceful manner) or you might be able to stick a proxy in the middle (http://www.telerik.com/fiddler) and use that to clip the socket if possible.

Upvotes: 1

Related Questions