Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4037172
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:18:52+00:00 2026-05-20T12:18:52+00:00

I’m currently using Jetty as my websocket server and I’m trying to make a

  • 0

I’m currently using Jetty as my websocket server and I’m trying to make a real-time game. I’m really new to this. So far I’ve managed to work on the easiest one (which is the chat). Now, I have a couple of issues:

  1. I’m trying to make a list of the current users connected in the server; how do I make such feature? I don’t really know if this is practical but my idea is that there’s a time interval that lets the server know that “Hey, I’m still alive.” I want my user list to be dynamic in such a way that if a user logs out, the list will refresh.

  2. I’m also trying to make “rooms” for my app. Basically, the people in “Room 1” can’t see what people in “Room 2” are doing; the other room functionalities are already self-explanatory. I still don’t have an idea for this; can someone recommend a way to implement this?

So far I’ve been having fun in learning this technology, and I would be very glad if there would be incoming help. These two are my issues so far. I’m also open for any suggestions for my app.

Thank you all in advance. 🙂

(Uhm, can #1 and #2 be solvable solely by Javascript?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:18:53+00:00Added an answer on May 20, 2026 at 12:18 pm

    Your question isn’t really jetty or websocket specific.

    Websockets simply provide a transport mechanism for your web browser to communicate with the server – what gets set over that transport, and how the server manages information are completely separate to the websocket.

    Firstly, if you haven’t read it already, read this article: http://cometdaily.com/2010/03/02/is-websocket-chat-simple/

    Secondly, consider using cometd to make this easier – version 2 (currently in Beta) supports websockets.

    As for your questions – there are 2 things you’ll need to do (cometd can help with this)

    1. Define a protocol
    Define a messaging protocol to sit on top of websockets. Websockets just provide a way to send chunks of data around, they don’t define what that data means. You’ll need to build something that does that, so you have messages that go from the client to the server like.

    • CONNECT “user”
    • STILL_ALIVE
    • JOIN_ROOM “room1”
    • LEAVE_ROOM
    • GET_USER_LIST
    • SEND_MESSAGE “message”

    And then you need messages form the server to the client

    • RECEIVE_MESSAGE “user” “message”
    • RECEIVE_USER_LIST “room1”

    You need to come up with some reliable way to send that data over a websocket. You can invent your own simple protocol (like the Jetty chat example does), you could use JSON, or XML, or CometD channels.

    2. Server-Side State
    If you’ve got simple chat working, then you must have made a start on this, but the other bit you need is a way to keep track of

    • how many users are connected
    • what their names are
    • which socket they’re connected to
    • which room they’re in

    Depending on how complex your system is going to become, you might be able to just store that in 1 big singleton on the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.