File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
lib/src/main/java/ua/naiksoftware/stomp Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,15 @@ public static StompClient over(Class clazz, String uri) {
2929 * @return StompClient for receiving and sending messages. Call #StompClient.connect
3030 */
3131 public static StompClient over (Class clazz , String uri , Map <String , String > connectHttpHeaders ) {
32- if (clazz == WebSocket .class ) {
33- return createStompClient (new WebSocketsConnectionProvider (uri , connectHttpHeaders ));
32+ try {
33+ if (Class .forName ("org.java_websocket.WebSocket" ) != null && clazz == WebSocket .class ) {
34+ return createStompClient (new WebSocketsConnectionProvider (uri , connectHttpHeaders ));
35+ } else {
36+ throw new RuntimeException ("Not supported overlay transport: " + clazz .getName ());
37+ }
38+ } catch (ClassNotFoundException e ) {
39+ throw new RuntimeException ("Class for transport " + clazz .getName () + " not included to project" , e );
3440 }
35-
36- throw new RuntimeException ("Not supported overlay transport: " + clazz .getName ());
3741 }
3842
3943 private static StompClient createStompClient (ConnectionProvider connectionProvider ) {
You can’t perform that action at this time.
0 commit comments