gRPC
Bidirectional Streaming
StreamSubscribeValidateHard
Description
Full duplex communication: both client and server send message streams.
Test Scenario
// Bidirectional streaming with grpcurl
# Interactive mode
grpcurl -plaintext -d @ \
localhost:50051 \
practice.orders.OrderService/ChatSupport
# Type messages and receive responses:
< {"sender": "user", "message": "I have a question"}
> {"sender": "support", "message": "How can I help?"}
< {"sender": "user", "message": "Where is my order?"}
> {"sender": "support", "message": "Checking..."}Testing Tips
- •Both sides send and receive independently
- •Good for chat, gaming, collaborative editing
- •Complex error handling required
// Playwright API Testing - gRPC (via REST gateway)import { test, expect } from '@playwright/test';test('gRPC unary call via gateway', async ({ request }) => {const response = await request.post('/api/grpc/UserService/GetUser', {data: { id: '1' }});expect(response.ok()).toBeTruthy();const data = await response.json();expect(data.user).toBeDefined();});
Challenge ID: grpc-bidirectional
2 frameworks available