Marty
Marty

Reputation: 2165

Running Jetty and jWebSocket concurrently

I have used Jetty in the past but I have little experience with jWebSocket. I would like to add to my current program, which uses the Jetty libraries, and make it also support WebSocket connections though port 80. I have read it can be done but find little to no source or examples to read about it. Any help is appreciated.

Upvotes: 1

Views: 927

Answers (3)

Punit Sachan
Punit Sachan

Reputation: 593

You have to modify two configuration files to run jWebSocket on jetty using port 80.

1:- Modify your jWebSocket.xml and add jetty engine entry at top of engine section of xml.

<engines>
<engine>
<name>org.jwebsocket.jetty.JettyEngine</name>
.
.
</engine>
</engines>

You can delete all other engine entries.

2:- Modify jetty.xml. This file can be located at jWebSocketJetty\src\main\resources folder. Modify first connector entry and set jetty.port property to 80.

<Call name="addConnector">
    <Arg>
        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host">
                <Property name="jetty.host" />
            </Set>
            <!-- Jetty default -->
            <!--
            <Set name="port">
                <Property name="jetty.port" default="80"/>
            </Set>
            -->
            <!-- jWebSocket default, can be changed to 80 -->
            <!-- but consider to update jWebSocket.js accordingly! -->
            <Set name="port">
                <Property name="jetty.port" default="80"/>
            </Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">443</Set>
            <Set name="lowResourcesConnections">20000</Set>
            <Set name="lowResourcesMaxIdleTime">5000</Set>

            <Set name="responseBufferSize">65536</Set>
        </New>
    </Arg>
</Call>

Upvotes: 1

Doug Mealing
Doug Mealing

Reputation: 26

I am currently working on the same thing, and so far I have found their task for this on Google Code:

http://code.google.com/p/jwebsocket/issues/detail?id=76

This was posted back in April of 2011:

"There's a separate project jWebSocketJetty available now in the Downloads / Nightly Build Section of jWebSocket.org now."

If you pull up the web.xml from that project, it looks like they've gotten their jwebsocket servlet working with jetty. I'll be looking into this more tomorrow.

Upvotes: 1

BillRobertson42
BillRobertson42

Reputation: 12883

I don't know, because I haven't used it, but would their JettyServlet would work?

Upvotes: 0

Related Questions