users@glassfish.java.net

Re: [Glassfish embedded] Does 3.1-SNAPSHOT support WebSockets ?

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

Hi,

my POM has this:

       <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>


and I start up Glassfish with this command:

mvn package embedded-glassfish:run

-Matthias

On Fri, Sep 3, 2010 at 9:36 PM, Marina Vatkina
<marina.vatkina_at_oracle.com> wrote:
> Do you use GF embedded API or EJB embedded API?
>
> -marina
>
> Matthias Wessendorf wrote:
>>
>> 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>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>



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