Module Assembly - Web Socket Listener - Porting Round Load Related Events

Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Project Overview

Currently, TopCoder Competition Engine used a customized way for communication between the client side (Arena applet) and the backend listeners. We are planning to implement a Web-based Arena based Web Socket protocol.

Previously, we have run contests to port all events of main listener to a standalone web socket listener, which provides a good solution by using the combination of socket.io (web client)  and netty.io (server side). 

We are continuing to support more features needed by the new Web-Based Arena.

Competition Task Overview

This contest is going to port Round Load Related Events to Web Socket Listener, so we can activiate rounds through web arena in the future. Currently, this functioanlity is available at Admin Tool, and which will contact the main listener to do the real load.

General Approach

We'd like to make the web socket listener as a wrapper over the main listener, the main logic should be implemented inside the main listener, several code changes are already checked in github repositories (https://github.com/cloudspokes/app).

You can learn from the changes needed.

Please check the https://github.com/cloudspokes/app/commit/c08bb4f10f0c3d090d5213402a0d13e6876e99a7#diff-d41d8cd98f00b204e9800998ecf8427e as a base knowledge to connecting the web socket listener and main listener, and follow the same approach to implement,  any improvement is welcome.

Please reuse existing functionality used in main listener as much as possible.

Round Load Related Events
In order to start a SRM, admin have to do the following steps in Admin Tool,

File -> Load Round Access

Click Test SRM Test SRM Round and click select

Click OK on Message Popup

Run contest -> Before contest -> Load Round

Click Yes on Confirm popup

Click OK on Message popup

You can start from com.topcoder.server.AdminListener.AdminProcessor,

            // Change round requests and refresh access information requests can always be executed.  Feed them
            // immediately to the back end.
            if (request instanceof RoundAccessRequest) {
                backEndQueue.put(new BackEndRoundAccessRequest(sender, userId.longValue()));
                return;
            } else if (request instanceof ChangeRoundRequest) {
                ChangeRoundRequest req = (ChangeRoundRequest)request;
                BackEndChangeRoundRequest bereq = new BackEndChangeRoundRequest(
                    sender, userId.longValue(),req.getRoundId());
                backEndQueue.put(bereq);
                return;

and com.topcoder.server.processor.Processor

    static void loadContestRound(long roundID) {
        Round round = CoreServices.getContestRound((int) roundID);
        if (round.isActive()) {
            unloadContestRound(roundID);
        }
        //We need to broadcast the round before the round is actually loaded.
        //This is because timer tasks will notify phase events as soon as the round is loaded, causing
        //exceptions in the client if it does not have the round.
        round = CoreServices.getContestRound((int) roundID);
        fillRoundConnectionsForBroadcasting(round);
        initNotifyRoundLoaded(round);
        CoreServices.loadContestRound((int) roundID);
        notifyRoundLoaded(round);
    }

Here are the request and response for the existing functionality, but not complete, but it is good for starting point.

  • com.topcoder.server.AdminListener.request.RoundAccessRequest
  • com.topcoder.server.AdminListener.request.ChangeRoundRequest
  • com.topcoder.server.AdminListener.response. RoundAccessResponse
  • com.topcoder.server.AdminListener.response. ChangeRoundResponse
  • com.topcoder.server.AdminListener.request.LoadRoundRequest
  • com.topcoder.server.AdminListener.response. CommandSucceededResponse

Web Demo

In order to demonstrate your solution, you are expected to update the demo (provided in forum), to demonstrate similar use cases.

in order to prepare the data, you can use Arena applet to do other work.

Winner Responsibility

Winner will be responsible to create pull request in final fix phase, and help with the merge.

About Code Base

For the code under /home/apps/dev directory, some are hosted in internal svn repositories, some are hosted in private repositories in github.

You can check Source Code Management For TopCoder Competition Engine - TopCoder Wiki

For SVN Access, please send request to support@topcoder.com, For github access, please post your github account in forum to ask PM to grant you access.

Arena VM

Before asking your own VM, you need to have a public key on your profile before asking for the VM.

You can find more details on how to generate a key http://apps.topcoder.com/wiki/display/projects/Generate+SSH+Key and how to connect using it http://apps.topcoder.com/wiki/display/projects/Connect+Using+SSH+Key.

To use the Arena VM, please follow http://apps.topcoder.com/wiki/display/docs/Competition+Engine+VM+Setup

Currently, we moved several main projects to github, please check http://apps.topcoder.com/wiki/display/~fireice/Source+Code+Management+For+TopCoder+Competition+Engine

If you want to have local access to github, please create your own github account, and ask access in forum.



Final Submission Guidelines

Submission Deliverables

Below is an overview of the deliverables:

  • Code Changes for the solution, please include the svn revision and git commit hash
  • A complete and detailed deployment documented explaining how to deploy the application including configuration information.

Final Submission

For each member, the final submission should be uploaded to the Online Review Tool.

ELIGIBLE EVENTS:

2015 topcoder Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30044690