K Kevin Gladson
K Kevin Gladson

Reputation: 1

Testing Stomp Client using Postman from Spring Web Socket

I am not able test by subscribing to a particular method using postman

WebSocketConfiguration.java

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfiguration implements WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/portfolio");
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.setApplicationDestinationPrefixes("/app");
        registry.enableSimpleBroker("/topic");
    }
}

WebsocketController.java


@Controller
public class WebSocketController {
    @MessageMapping("/greeting")
    public String handle(String greeting) {
        return "[" + getTimestamp() + ": " + greeting;
    }

    private String getTimestamp() {
        return new SimpleDateFormat("MM/dd/yyyy h:mm:ss a").format(new Date());
    }
}

How can test this thing in postman since i can send any message and recieve nothing?

i tried to the connect the websocket but am not able to subscribe to the method "/topic/greeting" so there is no respose from the server

Upvotes: 0

Views: 41

Answers (0)

Related Questions