GithubHelp home page GithubHelp logo

tempbottle / spring-websocket-portfolio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstoyanchev/spring-websocket-portfolio

0.0 2.0 0.0 1.33 MB

Shell 0.14% Java 16.02% CSS 0.18% JavaScript 81.87% HTML 1.78%

spring-websocket-portfolio's Introduction

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:

Server-side runs on Tomcat 7.0.47+, Jetty 9.0.7+, or Glassfish 4.0. Other servlet containers should also function correctly via fallback options (assuming Servlet 3.0) but they don't support WebSocket yet.

Also see the blog post introducing these features.

Tomcat 7/8

The app has been tested with this Tomcat 8 RC10 as well as Tomcat 7.0.47 which includes a backport of the Tomcat 8 WebSocket support.

For Tomcat 8, set TOMCAT8_HOME as an environment variable and use deployTomcat8.sh and shutdownTomcat8.sh in this directory.

For Tomcat 7, you can use mvn tomcat7:run.

Open a browser and go to http://localhost:8080/spring-websocket-portfolio/index.html

Jetty 9

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

Open a browser and go to http://localhost:8080/spring-websocket-portfolio/index.html

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

Glassfish

After unzipping Glassfish 4 start the server:

<unzip_dir>/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 http://localhost:8080/spring-websocket-portfolio/index.html

WildFly/Undertow

Support available startin with Spring Framework 4.0.1. Requires WildFly 8.0.0.Final.

Unzip the WildFly server.

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

Open a browser and go to http://localhost:8080/spring-websocket-portfolio/index.html

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.

spring-websocket-portfolio's People

Contributors

bclozel avatar ghillert avatar rstoyanchev avatar rwinch avatar scothis avatar wangningx avatar wilkinsona avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.