vahidhedayati / grails-wschat-plugin

Grails websocket chat Plugin provides a multi-chat room add-on to an existing grails based site. provides: Private Messaging/WebRTC/Offline PM + room booking/reservations. Websocket TicTactoe. Add Live Chat to your Grails application
http://grails.org/plugin/wschat
Apache License 2.0
22 stars 10 forks source link

disconnecting from server... When i runn my app in Prod Mode #27

Closed arthurolara closed 7 years ago

arthurolara commented 7 years ago

Hi,I'm trying to use this plugin, with grails 2.5.0, it looks fine when i run the app in development mode, but when i try to run in Production mode, it doesn't work, hope some one can help.

Intellji Log: | Error javax.websocket.DeploymentException: The HTTP response from the server [HTTP/1.1 404 Not Found ] did not permit the HTTP upgrade to WebSocket | Error at org.apache.tomcat.websocket.WsWebSocketContainer.parseStatus(WsWebSocketContainer.java:597) | Error at org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:581) | Error at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:307) | Error at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:166) | Error at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:187)

captura de pantalla de 2017-02-25 12 04 48

My settings

BuildConfig.grovey

plugins { // plugins for the build system only build ":tomcat:7.0.55.2" // or ":tomcat:8.0.20"

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.8'
    compile ":asset-pipeline:2.1.5"
    compile ":wschat:1.31"

    // plugins needed at runtime but not for compilation
    runtime ":hibernate4:4.3.8.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"

    // Uncomment these to enable additional asset-pipeline capabilities
    //compile ":sass-asset-pipeline:1.9.0"
    //compile ":less-asset-pipeline:1.10.0"
    //compile ":coffee-asset-pipeline:1.8.0"
    //compile ":handlebars-asset-pipeline:1.3.0.3"
}

Config.grovy

wschat.enableSecurity='true'

grails.plugin.springsecurity.userLookup.userDomainClassName = 'grails.plugin.wschat.ChatAuth' grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'grails.plugin.wschat.ChatAuthChatRole' grails.plugin.springsecurity.authority.className = 'grails.plugin.wschat.ChatRole' grails.plugin.springsecurity.controllerAnnotations.staticRules = [ '/': ['permitAll'], '/error': ['permitAll'], '/index': ['permitAll'], '/index.gsp': ['permitAll'], '/shutdown': ['permitAll'], '/assets/': ['permitAll'], '//js/': ['permitAll'], '//css/': ['permitAll'], '//images/': ['permitAll'], '//favicon.ico': ['permitAll'], '/wsChat/': ['permitAll'], '/wsChatAdmin/': ['permitAll'], '/wsCamEndpoint/': ['permitAll'], '/wsChatEndpoint/': ['permitAll'], '/wsChatFileEndpoint/': ['permitAll'], '/TicTacToeServer/': ['permitAll'], '/wsCamEndpoint': ['permitAll'], '/wsChatEndpoint': ['permitAll'], '/wsChatFileEndpoint': ['permitAll'], '/TicTacToeServer': ['permitAll'], '/dbconsole/': ['permitAll'], '/ChatClientEndpoint/': ['permitAll'], '/WsChatClientEndpoint/**': ['permitAll'], '/ChatClientEndpoint': ['permitAll'], '/WsChatClientEndpoint': ['permitAll'] ]

grails.plugin.springsecurity.securityConfigType = "Annotation"

//Para el chat //https://github.com/vahidhedayati/grails-wschat-plugin/wiki/Config.groovy

wschat.defaultperm='user'

/*

wschat.removeAppName=no

/* DB Booking Date

/*

Thanks

vahidhedayati commented 7 years ago

yes the problem is very easy:

wschat.hostname="localhost:8080" you can see it in the error console it suggest localhost:8080/wscha1.31/ was unavailable.

To try and get your head around this. When you communicate via websockets, it has to transmit the traffic to the actual host that communicates in websockets.

Whilst you are in development mode you will notice and even visit url http://localhost:8080/appName which then binds and runs and would not throw that error message.

In short edit this line for production and set it to be the actual hostname used to access your production site.

so if production url to get access to the site is

http://www.myexampledomain.com/wschat1.31/

the wschat.hostname='www.myexampledomain.com'

arthurolara commented 7 years ago

nice!!, thaks it works fine now

regards