Home AMX User Forum NetLinx Studio

HTML5 WebSocket

Hey All!

Playing with WebSockets, thought you all could use this! I made a WebSocket server. Use only Chrome (Mac, Windows), IE10 (Windows), Safari (Mac 6.0.2), iOS (Chrome, Safari), Firefox (12) web browsers if you expect it to work. Would need to implement MD5 with Safari windows (5.1.7), so I wont.

This is provided as is with no support. Modify, delete, don't use what ever you like!

So create your own HTML5 Web User Interfaces! Fast two way communication.

Does Push, Release, On, Off, Level (to,from), commands (to,from), strings (to,from).

Make sure you update the IP address in the test.html file to that of your controller.

Enjoy!

Jeff

Comments

  • AMXJeffAMXJeff Posts: 450
    Update

    Hey I have been updating this, the HTML pages are still not pretty but hey that is your job.

    For some of you that have been looking for a SHA1 hashing routine I had to create one for the server.

    Please use this version if you downloaded it before.

    Enjoy!

    Jeff

    Source has been moved! Go to Link below...

    http://code.google.com/p/amx-websocket-server
  • PhreaKPhreaK Posts: 966
    Nice one. Rather than continuously posting updates you should have a look at GitHub, Google Code or any of the other amazing free project hosting sites. This will let you set up the project and track changes via version control and also allow others to easily subscribe to any updates.
  • Thanks for sharing this!
  • AMXJeffAMXJeff Posts: 450
    PhreaK wrote: »
    Nice one. Rather than continuously posting updates you should have a look at GitHub, Google Code or any of the other amazing free project hosting sites. This will let you set up the project and track changes via version control and also allow others to easily subscribe to any updates.

    Thanks for the advise, not sure how much I am going to be updating this, because I am moving to my duet version. But good suggestion none the less. This was originally just for testing my ideas... Find source here!

    http://code.google.com/p/amx-websocket-server/
  • mstocummstocum Posts: 120
    AMXJeff wrote: »
    Thanks for the advise, not sure how much I am going to be updating this, because I am moving to my duet version.

    Do you have any plans to release the Duet version as well?
  • AMXJeffAMXJeff Posts: 450
    mstocum wrote: »
    Do you have any plans to release the Duet version as well?

    The duet version is for my customers, so sorry no. However the NetLinx version should suffice. Enjoy!
  • joshjosh Posts: 4
    Thanks!

    Thanks, Jeff! We were working on an implementation of this earlier when we ran across yours. Do you happen to know if there's any way to update/configure the Jetty web server? Currently we write a file to the web server when the socket connections are maxed out so the next client that tries to connect knows what the issue is. It would be great to enable the server to send the access control allow origin header so client files not served from the local web server can do a cross domain request to check for that file.
  • AMXJeffAMXJeff Posts: 450
    josh wrote: »
    Thanks, Jeff! We were working on an implementation of this earlier when we ran across yours. Do you happen to know if there's any way to update/configure the Jetty web server? Currently we write a file to the web server when the socket connections are maxed out so the next client that tries to connect knows what the issue is. It would be great to enable the server to send the access control allow origin header so client files not served from the local web server can do a cross domain request to check for that file.

    Well... I think I follow what your asking... There is a way to write servlets in duet that allows you to have access to the web server. However you need a secret license key to register the servlet with the service. AMX won't be releasing that any time soon.
  • joshjosh Posts: 4
    Hmm, have any other ideas on how to handle max connections? Are you pretty much just letting new connections silently fail?
  • AMXJeffAMXJeff Posts: 450
    josh wrote: »
    Hmm, have any other ideas on how to handle max connections? Are you pretty much just letting new connections silently fail?

    You running into the 200 connection limit? I normally allow much less, when the connection get just above my imposed limit, I send a message to the client and then disconnect them.
  • sonnysonny Posts: 208
    josh wrote: »
    Thanks, Jeff! We were working on an implementation of this earlier when we ran across yours. Do you happen to know if there's any way to update/configure the Jetty web server? Currently we write a file to the web server when the socket connections are maxed out so the next client that tries to connect knows what the issue is. It would be great to enable the server to send the access control allow origin header so client files not served from the local web server can do a cross domain request to check for that file.

    Assuming you're still in v3, just create an instance of Jetty on an open port in your module. Then you can add your servlets. To solve the above issue, do a...

    response.setHeader("Access-Control-Allow-Origin", some_host);
  • voltboyeevoltboyee Posts: 4
    Thanks!

    Thanks for posting this. This will come in very handy :)
Sign In or Register to comment.