mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-18 16:27:42 +01:00
...
This commit is contained in:
@@ -20,7 +20,7 @@ public static class Program
|
||||
Console.WriteLine("Choose an example to run:");
|
||||
Console.WriteLine("1. Echo Server");
|
||||
Console.WriteLine("2. Custom Message Handler");
|
||||
Console.WriteLine("3. Broadcast Server");
|
||||
Console.WriteLine("3. ...");
|
||||
Console.WriteLine("4. Scenario/State Machine");
|
||||
Console.WriteLine("5. WebSocket Proxy");
|
||||
Console.WriteLine("6. Multiple WebSocket Endpoints");
|
||||
@@ -419,28 +419,6 @@ public static class Program
|
||||
)
|
||||
);
|
||||
|
||||
// Endpoint 3: JSON service
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/json")
|
||||
.WithWebSocketUpgrade()
|
||||
)
|
||||
.RespondWith(Response.Create()
|
||||
.WithWebSocket(ws => ws
|
||||
.WithMessageHandler(async (msg, ctx) =>
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
timestamp = DateTime.UtcNow,
|
||||
message = msg.Text,
|
||||
length = msg.Text?.Length ?? 0,
|
||||
type = msg.MessageType.ToString()
|
||||
};
|
||||
await ctx.SendAsJsonAsync(response);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
// Endpoint 4: Protocol-specific
|
||||
server
|
||||
.Given(Request.Create()
|
||||
@@ -586,27 +564,6 @@ public static class Program
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
// JSON endpoint
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/json")
|
||||
.WithWebSocketUpgrade()
|
||||
)
|
||||
.RespondWith(Response.Create()
|
||||
.WithWebSocket(ws => ws
|
||||
.WithMessageHandler(async (msg, ctx) =>
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
timestamp = DateTime.UtcNow,
|
||||
message = msg.Text,
|
||||
connectionId = ctx.ConnectionId
|
||||
};
|
||||
await ctx.SendAsJsonAsync(response);
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static void SetupGameScenario(WireMockServer server)
|
||||
|
||||
Reference in New Issue
Block a user