# Web-socket version

**URL:** <https://forum.inductiveautomation.com/t/web-socket-version/19215>\
**Category:** Module Development\
**Created:** [August 12, 2018, 6:33am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215 "2018-08-12T06:33:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 12, 2018, 6:33am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/1 "2018-08-12T06:33:47Z")

</div>

1 Which version of web socket does Ignition support JSR or Jetty?  
2. What are the maven dependencies for this version in Ignition sdk?  
3. Where is the link to the Ignition java class library documentation on line?  
4. from which version of Ignition onwards is this supported? (I guess 7.7 onwards)?

Any inputs from Colby?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 13, 2018, 6:50pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/2 "2018-08-13T18:50:06Z")

</div>

I have put the following dependencies in maven

```
   <dependency>
       <groupId>org.eclipse.jetty.websocket</groupId>
       <artifactId>javax-websocket-server-impl</artifactId>
       <version>9.4.12.RC1</version>
   </dependency>

```

But the errors don't disappear!  
I even included Ignition matro-jars and catapult dependencies from Ignition, however the errore don't go away.

help will be appreciated.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 13, 2018, 7:26pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/3 "2018-08-13T19:26:21Z")

</div>

What errors? What are you trying to do?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 14, 2018, 3:25am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/4 "2018-08-14T03:25:43Z")

</div>

while trying to import with "import.javax.websocket.\*" in my code, I get error "package websocket doesnot exist", even including individual classes gives same error. I am trying to establish communication with NJSCADA.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 14, 2018, 12:41pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/5 "2018-08-14T12:41:00Z")

</div>

We don’t export any of the WebSocket APIs in a way that you can see them as a module author.

The latest version of 7.9 uses Jetty 9.3.8. You might be able to add these dependencies, using provided scope to indicate they’re already going to be on the class path and don’t need to be packaged in your module:

```auto
<dependency>
  <groupId>org.eclipse.jetty.websocket</groupId>
  <artifactId>websocket-server</artifactId>
  <version>9.3.8.v20160314</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.eclipse.jetty.websocket</groupId>
  <artifactId>websocket-servlet</artifactId>
  <version>9.3.8.v20160314</version>
  <scope>provided</scope>
</dependency>

```

The `javax.websocket.*` import isn’t going to work because we don’t include or use the JSR 356 WebSocket API.

These dependencies are only for creating server-side WebSockets. You’re on your own if you need client ones.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 14, 2018, 1:06pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/6 "2018-08-14T13:06:24Z")

</div>

> [@Kevin.Herron](#):
>
> \<dependency\>  
> \<groupId\>org.eclipse.jetty.websocket\</groupId\>  
> \<artifactId\>websocket-server\</artifactId\>  
> \<version\>9.3.8.v20160314\</version\>  
> \<scope\>provided\</scope\>  
> \</dependency\>
> 
> \<dependency\>  
> \<groupId\>org.eclipse.jetty.websocket\</groupId\>  
> \<artifactId\>websocket-server\</artifactId\>  
> \<version\>9.3.8.v20160314\</version\>  
> \<scope\>provided\</scope\>  
> \</dependency\>

why its included twice? They are the same

.[quote="Kevin.Herron, post:5, topic:19215"]  
The javax.websocket.\* import isn't going to work because we don't include or use the JSR 356 WebSocket API.  
[/quote]

I tried individually

import javax.websocket.OnError;  
import javax.websocket.OnMessage;  
import javax.websocket.OnOpen;  
import javax.websocket.Session;  
import javax.websocket.server.ServerEndpoint;

But still error, which library should I import?

> [@Kevin.Herron](#):
>
> These dependencies are only for creating server-side WebSockets. You're on your own if you need client ones.

I am trying only server side functionality in my module.[quote="Kevin.Herron, post:5, topic:19215"]  
We don't export any of the WebSocket APIs in a way that you can see them as a module author.  
[/quote]

got it.

> [@Kevin.Herron](#):
>
> The latest version of 7.9 uses Jetty 9.3.8. You might be able to add these dependencies, using provided scope to indicate they're already going to be on the class path and don't need to be packaged in your module:

Though I have installed 7.9 version on my development system, but will it not work on older version like 7.7 & 7.8 of Ignition? I guess it was introduced in version 7.7 as presented in 2015 ICC presentation by Colby if I remember.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 14, 2018, 1:17pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/7 "2018-08-14T13:17:02Z")

</div>

I updated the dependencies so they aren’t the same.

None of the `javax` imports will work because they aren’t on the classpath. You can add them yourself and see if they work.

The Jetty websocket jars should be included as far back as 7.7, though I don’t know what version it would be.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 14, 2018, 1:24pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/8 "2018-08-14T13:24:42Z")

</div>

Oh I didn't notice the difference!. Sorry about that.  
Thanks a lot, I will try to include them in the classpath.  
I will change the Ignition version number in dependencies to 7.7 or 7.8 and try.

Thanks a lot kevin, you are always very helpful.

b/r

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 19, 2018, 6:11pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/9 "2018-08-19T18:11:22Z")

</div>

- Which version do you recommend JSR or JETTY?
- What are the maven dependencies for JSR version?
- Which version does Ignition use?
- I would prefer JSR version as its more industry standard.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 19, 2018, 7:57pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/10 "2018-08-19T19:57:42Z")

</div>

> Which version do you recommend JSR or JETTY?

Jetty because it's already included.

> What are the maven dependencies for JSR version?

Don't know, google it?

> Which version does Ignition use?

Jetty

> I would prefer JSR version as its more industry standard.

Find and add the Jetty/JSR API artifact then.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 20, 2018, 3:31am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/11 "2018-08-20T03:31:14Z")

</div>

Thanks a lot Kevin. Let me first start with Jetty as its readily available in In jetty. Hope fully it will be compatible with industry standard as I want to communicate with NJSCADA!

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 20, 2018, 8:54am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/12 "2018-08-20T08:54:16Z")

</div>

Hi Kevin,

I created jetty ws server in my module, while accessing it from from a browser on 8088 (ignition) port, I get following error:

**webSocket connection to 'ws://localhost:8088/test' failed: Error during WebSocket handshake: Unexpected response code: 302**

With 8080 portI get different error:

**WebSocket connection to 'ws://localhost:8080/test' failed: Error in connection establishment: net::ERR\_CONNECTION\_REFUSED**

Should the jetty server (Ignition gateway server) be restarted after installing my module for the servlet to get registered? I tried that but doesn't help.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 20, 2018, 11:44am UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/13 "2018-08-20T11:44:25Z")

</div>

I tried even the JSR365 version , but on port 8088 it gives the same error:

**failed: Error during WebSocket handshake: Unexpected response code: 302**

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [August 20, 2018, 3:55pm UTC](https://forum.inductiveautomation.com/t/web-socket-version/19215/14 "2018-08-20T15:55:24Z")

</div>

Will the ws client work only under an Ignition client session? Otherwise how does it get the http session for handshake to convert to ws client? I should also be able to access the ws server from a non browser client as well. How does ignition EAM module work?
