Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AntyaDev authored Jan 11, 2024
1 parent a0c0ca7 commit c9a9269
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# NBomber.WebSockets
[![build](https://github.com/PragmaticFlow/NBomber.WebSockets/actions/workflows/build.yml/badge.svg)](https://github.com/PragmaticFlow/NBomber.WebSockets/actions/workflows/build.yml)
[![NuGet](https://img.shields.io/nuget/v/nbomber.websockets.svg)](https://www.nuget.org/packages/nbomber.websockets/)

NBomber plugin for defining WebSockets scenarios.

### Documentation
Documentation is located [here](https://nbomber.com/docs/protocols/http)

### Example
```csharp
var scenario = Scenario.Create("web_sockets", async context =>
{
using var websocket = new WebSocket(new WebSocketConfig());

var connect = await Step.Run("connect", context, async () =>
{
await websocket.Connect("ws://localhost:5231/ws");
return Response.Ok();
});

var ping = await Step.Run("ping", context, async () =>
{
await websocket.Send(payload);
return Response.Ok(sizeBytes: payload.Length);
});

var pong = await Step.Run("pong", context, async () =>
{
using var response = await websocket.Receive();
return Response.Ok(sizeBytes: response.Data.Length);
});

var disconnect = await Step.Run("disconnect", context, async () =>
{
await websocket.Close();
return Response.Ok();
});

return Response.Ok();
});
```

0 comments on commit c9a9269

Please sign in to comment.