Search code examples
jquerygrailsasset-pipelinespring-websocketgrails-4

Grails 4: Grails Spring Websocket 2.5.0.M1 upgrade has broken websockets


After upgrading to Grails Spring websocket as part of my move to Grails4, my websocket implementation stopped working with the following error.

Firefox console output

There appears to be a correlation with how asset pipeline dynamically constructs these assets (of which my version is 3.0.10) but I'm not clear on where the problem lies.

Admittedly, I'm still using an older version of jQuery (1.11.1) but I feel this should not be the source of the problem unless advised otherwise.

Just wondering if anyone has had a similar experience before I open an issue with the plugin.

The above is currently only being run in development mode (no precompiled assets).


Solution

  • This appears to have been a namespace issue with my choice of filename. A nasty one to try and debug but got there in the end.

    My "main" JavaScript file was called main.js which seems to have clashed with convention used within the Grails WebSocket plugin.

    After renaming this file to app_main.js the error went away.

    PS: I also upgraded jQuery and asset-pipeline but it was above that appeared to be directly responsible for fixing the error.