当我尝试使用命令从Java客户端向服务器发送消息时:
connectedHeaders.add("userId", UUID.randomUUID().toString());
session.send("/app/start_smpp", connectedHeaders.getFirst("userId"));
我收到错误:
11:49:43.596 [clientInboundChannel-7] ERROR o.s.w.s.m.WebSocketAnnotationMethodMessageHandler - Unhandled exception
org.springframework.messaging.MessageHandlingException: Missing header 'userId' for method parameter type [class java.lang.String]
我不知道如何在java中发送标头userID
在js代码中看起来像这样:
session.send(destination, {headers}, body);