users@glassfish.java.net

[Glassfish embedded] Does 3.1-SNAPSHOT support WebSockets ?

From: Matthias Wessendorf <matzew_at_apache.org>
Date: Fri, 3 Sep 2010 21:26:01 +0200

Hi,

I wonder how to configure the equivalent setting to:

./asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.websockets-support-enabled=true


in glassfish-embedded (3.1-SNAPSHOT) ?


I copied the domain.xml from the JAR file(/org/glassfish/embed/domain.xml)
to my maven ${basedir}.
Yes, it is used (I see in when booting up, by reading the LOGs (domainURI).

However, when I do something like (in that particular domain.xml):
.....
      <network-config>
        <protocols>
          <protocol name="http-listener-1">
            <http websockets-support-enabled="true"
default-virtual-server="server" max-connections="250">
              <file-cache></file-cache>
            </http>
          </protocol>
        </protocols>
.....

It looks like it does NOT enable websocket support.

The page that I load gives me an alert("socket closed"); direclty
after I load the page:

==>

<head>
    <title>WebSockets Ping</title>
  <script>
// core init of the "framework"
ws = new WebSocket("ws://192.168.0.100:8080/ticker/wsLiveTicker");
ws.onmessage = function(evt)
{
 var pTag = document.createElement("p");
 var text = document.createTextNode(evt.data);
 pTag.appendChild(text);
 document.getElementById('content').appendChild(pTag);
};
ws.onclose = function()
{
 alert("socket closed");
};
........


<==


So, does the 3.1-embedded support WebSockets, at this time ?


-Matthias

BTW. my pom entry looks like:
      <plugin>
        <groupId>org.glassfish</groupId>
        <artifactId>maven-embedded-glassfish-plugin</artifactId>
        <version>3.1-SNAPSHOT</version>
        <configuration>
          <port>8080</port>
          <contextRoot>/ticker</contextRoot>
          <autoDelete>true</autoDelete>
          <configFile>${basedir}/domain.xml</configFile>
        </configuration>
      </plugin>



-- 
Matthias Wessendorf
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf