Websocket not working as expected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AgentT
    Member
    • Aug 2021
    • 77

    Websocket not working as expected

    Hey we recently upgraded our ESPO version from 6 to 7 and we are currently running v7.1.7.

    But the websocket is not working as expected after the upgrade. We use docker containers to run ESPO instance, we have 2 containers one which runs the app itself and one more for websocket which just forwards the 8080 port from inside the container to an port on the outside (say 40100).

    So in the config.php I have:
    Code:
    'useWebSocket' => true,
    'webSocketUrl' => 'ws://127.0.0.1:40100',
    'webSocketPort' => '8080'
    When I load the CRM and check the Network tab in the dev tools, everything is fine, there is the ?authToken entry in the WS section. But if I make any changes to the entity, there is no incoming or outgoing socket requests.

    The same setup works in ESPO v6 but not in v7.

    Any help would be appreciated.
  • DashingUno
    Member
    • Apr 2022
    • 45

    #2
    We've have also been battling with this over a month to no avail: https://forum.espocrm.com/forum/inst...and-ssl-issues

    If you do find a way to fix this, pls share the solution, or maybe some of the suggestions in that post can work for you

    Comment

    • AgentT
      Member
      • Aug 2021
      • 77

      #3
      I did some digging and found this in the chrome logs:
      Code:
      Could not load content for http://127.0.0.1:40806/node_modules/autobahn-espo/autobahn.js (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)
      This originates from the line 140 in clinet/src/web-socket-manager.js which is:
      Code:
      this.connection.subscribe(category, callback);
      yuri Any idea why this is happening?
      I recently upgraded from ESPO v6 to V7 (latest version).

      Comment

      • AgentT
        Member
        • Aug 2021
        • 77

        #4
        yuri How can I verify if all the required libraries has been installed correctly?

        I do php -ini | grep zmq and I get this:
        Code:
        /etc/php8/conf.d/20-zmq.ini,
        zmq
        libzmq version => 4.3.4
        I installed ZMQ like it's shown here: https://github.com/espocrm/espocrm-d...Dockerfile#L18
        And its installed correctly as I verified:
        Code:
        /www/espocrm $ apk info | grep zmq
        libzmq
        /www/espocrm $ apk info | grep zeromq
        zeromq-dev
        Any pointers would be really appreciated. Been struggling to find a solution for over a week.
        I am running alpine 3.16 with PHP8 and I am on ESPO v7.1.7.

        Thanks.
        yuri

        Comment

        • yuri
          Member
          • Mar 2014
          • 8452

          #5
          Seems your Espo is in developer mode (in config).
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment


          • AgentT
            AgentT commented
            Editing a comment
            isDeveloperMode is not present in my config.php, so by default it will be false. Even tried setting it to false explicitly and its no good.
        • AgentT
          Member
          • Aug 2021
          • 77

          #6
          I found the problem!! It's the webSocketZeroMQSubmissionDsn that was causing issues. The default value tcp://localhost:5555 would not work for some reason, but when I updated it with the actual IP of the container something like tcp://172.2.0.1:5555 websocket works.

          yuri Why doesn't "localhost" resolve to the correct IP, why should it be the actual IP? "0.0.0.0" also does not work.

          So what I did was put this in the config.php file:
          Code:
          'webSocketZeroMQSubmissionDsn' => "tcp://".getHostByName(getHostName()).":5555",
          'webSocketZeroMQSubscriberDsn' => 'tcp://*:5555'
          DashingUno This might solve your issue as well.

          Comment

          Working...