Bilal-S / iis2tomcat

AJP Connector between Internet Information Services (IIS) and Apache Tomcat
http://www.boncode.net/boncode-connector
49 stars 32 forks source link

Can websockets be enabled? #46

Closed redtopia closed 7 years ago

redtopia commented 7 years ago

I am attempting to get websockets running on a Windows/IIS/Boncode/Lucee5.1 application. Are websockets supported, and if so, what do I need to do in order to connect them to Lucee? If not, what is it on the roadmap, or is there a workaround? For a workaround, I'm considering connecting to tomcat directly and bypassing IIS, but only for websocket endpoints.

Bilal-S commented 7 years ago

The connector is an intermediary between iis and tomcat, it does not directly talk to clients. Thus, iis will need to enable the sockets. IIS does support websockets but only iis 8 and later. https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

You will have to register the handler for the socketendpoint you wish to use. However, I have not tried this myself.

Alternately you can connect to tomcat directly as you stated.

redtopia commented 7 years ago

Yes, I understand that the Boncode Connector is not a web server and would not "handle" the websocket connection itself. Apps that use the Boncode Connector to connect IIS with Tomcat need a way for websocket requests to be passed to Tomcat.

Currently, Lucee's support for websockets is done using a new Lucee extension, which uses the Tomcat websocket library. I am thinking that the Boncode Connector would be able to take websocket requests that are received in IIS and pass them to Tomcat to be handled. Am I wrong about that?

Bilal-S commented 7 years ago

You are correct. I summarized my understanding.

Currently the connector is not web-socket aware. I do think this would need to change and it would need to be made websockets aware for it to handle long running connections. We would also need to standardize how each message from the client should be passed to a given endpoint.

You can try to enable as is. Afaik you need to set the handler registration in IIS to support websocket, you can do this for one file:

var host = "ws://localhost/allmyfiles/WSHandler.cfm";

At this point this will probably not work, but messages might be helpful for future.

redtopia commented 7 years ago

I don't think the handler would work because Tomcat needs to get the request directly... not the handler. A .cfm or .cfc will only handle a single one way request. I order to handle a bidirectional connection, tomcat needs to get a hold of it.