Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

spring-websocket-portfolio

> 编程语言
Open source

Overview A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses …

758 stars0 likes3 views
WebsiteGitHub

About

Overview A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses …

Overview

A sample demonstrating capabilities in the Spring Framework to build WebSocket-style messaging applications. The application uses STOMP (over WebSocket) for messaging between browsers and server and SockJS for WebSocket fallback options.

Client-side libraries used:

  • stomp-websocket
  • sockjs-client
  • Twitter Bootstrap
  • Knockout.js

Server-side runs on Tomcat, Jetty, WildFly, Glassfish, and other Servlet 3.0+ containers with WebSocket support.

Tomcat

For Tomcat, set TOMCAT_HOME as an environment variable and use deployTomcat.sh and shutdownTomcat.sh in this directory.

Open a browser and go to

Jetty

The easiest way to run on Jetty is with mvn jetty:run.

Open a browser and go to

Note: To deploy to a Jetty installation, add this to Jetty's start.ini:

OPTIONS=plus
etc/jetty-plus.xml
OPTIONS=annotations
etc/jetty-annotations.xml

WildFly 10+

Unzip the WildFly server.

Set WILDFLY_HOME as an environment variable and use deployWildFly.sh in this directory.

Open a browser and go to

WebSphere Liberty 16+

Build and deploy with the following server configuration:

        jsp-2.3
        webSocket-1.1

Glassfish

After unzipping Glassfish 4 start the server:

/glassfish4/bin/asadmin start-domain

Set GLASSFISH4_HOME as an environment variable and use deployGlassfish.sh in this directory.

Open a browser and go to

Using a Message Broker

Out of the box, a "simple" message broker is used to send messages to subscribers (e.g. stock quotes) but you can optionally use a fully featured STOMP message broker such as RabbitMQ, ActiveMQ, and others, by following these steps:

  1. Install and start the message broker. For RabbitMQ make sure you've also installed the RabbitMQ STOMP plugin. For ActiveMQ you need to configure a STOMP transport connnector.
  2. Use the MessageBrokerConfigurer in WebSocketConfig.java to enable the STOMP broker relay instead of the simple broker.
  3. You may also need to configure additional STOMP broker relay properties such as relayHost, relayPort, systemLogin, systemPassword, depending on your message broker. The default settings should work for RabbitMQ and ActiveMQ.

Logging

To see all logging, enable TRACE for org.springframework.messaging and org.springframework.samples in log4j.xml.

Keep in mind that will generate a lot of information as messages flow through the application. The QuoteService for example generates a lot of messages frequently. You can modify it to send quotes less frequently or simply comment out the @Scheduled annotation.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言