Application provide Spring Cloud Gateway with WebSocket factory to shadow convert websocket-request to http-request and http-response to websocket-response. By JWT validation is using only token sign verification with RSA public key and for most performance result at first time cached in Hazelcast in-pods embedded cluster.
To export public key from keystore use:
openssl pkcs12 -clcerts -nokeys -out public.pem -in gateway.p12
Jwt-token capture from project with actual public key gateway.p12
keystore:
To run need Confluent Platform for start schema-registry in docker. After can see topics in: http://localhost:9021/
Generate avro classes: mvn compile
. After run Offset Explorer to look topic configuration.
Send Kafka message to any topic with POST[/kafka]:
{
"topic": "websocket-transport",
"body": {
"name": "bro",
"baseUrl": "http://gateway-service",
"uri": "kafka-websocket",
"body": "{'name':'...'}"
}
}
if choose websocket-transport
topic then message go outside throw WebSocket to browser or mobile application.