fabric8io / mockwebserver

An extension of okhttp's mockwebserver, that provides a DSL and is easier to use
Apache License 2.0
113 stars 38 forks source link

New Web socket features: expect an http request and expect a sent soc… #38

Closed alexmiragall closed 5 years ago

alexmiragall commented 5 years ago

added new features for webSocket API: server.expect().get().withPath("/api/v1/users/watch") .andUpgradeToWebSocket() .open() .expectHttpRequest("/api/v1/create").andEmit("CREATED").once() .expectSentWebSocketMessage("CREATED").andEmit("DELETED").once() .done() .once()

When using expectHttpRequest we are using a normal httpRequest as the trigger to send a response through the socket. When using expectSentWebSocketMessage we are using a message received through the socket to send a response (this way we can send multiple messages through the socket). In the example when receiving a GET/POST/PUT/DELETE etc at "/api/v1/create" endpoint we will send through the web socket "CREATED" and just before "DELETED". #37

rohanKanojia commented 5 years ago

Thanks @alexmiragall

rohanKanojia commented 5 years ago

@alexmiragall : I will release it this weekend(hopefully Sunday) or maybe next week

alexmiragall commented 5 years ago

thanks @rohanKanojia !

rohanKanojia commented 5 years ago

@alexmiragall : I've released v0.1.2 which should have your fix :-)