beevelop / ng-stomp

:bookmark_tabs: STOMP for AngularJS
http://beevelop.github.io/stomp-ui/
MIT License
43 stars 43 forks source link

heart-beat settings #18

Closed iamvasim786 closed 7 years ago

iamvasim786 commented 7 years ago

how to set heart-beat value in headers ? ex - headers ={ login:"",passcode:"",heart-beat:"20000,50000"} not work for me.

beevelop commented 7 years ago

@iamvasim786 Could you provide a full code snippet?

iamvasim786 commented 7 years ago

@beevelop this is my code -

var connectHeaders =  {login:"xxx",passcode:"xxx",heart-beat:"20000,50000"};

$stomp
      .connect('/endpoint', connectHeaders)

      // frame = CONNECTED headers
      .then(function (frame) {
        var subscription = $stomp.subscribe('/dest', function (payload, headers, res) {
          $scope.payload = payload
        }, {
          'headers': 'are awesome'
        })

        // Unsubscribe
        subscription.unsubscribe()

        // Send message
        $stomp.send('/dest', {
          message: 'body'
        }, {
          priority: 9,
          custom: 42 // Custom Headers
        })

      })
beevelop commented 7 years ago

Looking into the stomp-websocket docs, it seems as if this is not possible via connect headers: http://jmesnil.net/stomp-websocket/doc/#heartbeat

I'm thinking about making heartbeat.outgoing and heartbeat.incoming configurable with the help of an Angular-Provider.

beevelop commented 7 years ago

@iamvasim786 You can checkout the feature-heartbeat branch. You should be able to configure incoming and outgoing heartbeat settings with the $stompProvider:

foobar.config(function ($stompProvider) {
  $stompProvider.setIncomingHeartbeat(1337)
  $stompProvider.setOutgoingHeartbeat(1337)
})

All the rest should be backwards compatible with the Readme example.

iamvasim786 commented 7 years ago

https://github.com/beevelop

thanks, it's working now .

beevelop commented 7 years ago

@iamvasim786 Thank your for verifying. I'll incorporate the changes into the next release.