davinkevin / AngularStompDK

Angular service to communicate to Stomp-Websocket
http://davinkevin.github.io/AngularStompDK/
Apache License 2.0
36 stars 12 forks source link

Ability to change heartbeat values #15

Closed josephrace closed 8 years ago

josephrace commented 8 years ago

The Stomp.js library has the ability to change the incoming and outgoing heartbeat values on the client. I'm interested in using AngularStompDK but need to be able to change these heartbeat values. It would be nice to be able to do this via the config.

davinkevin commented 8 years ago

You want to change the heart-beat timing value define with

client.heartbeat.outgoing = 20000; // client will send heartbeats every 20000ms
client.heartbeat.incoming = 0;     // client does not want to receive heartbeats
                                       // from the server

In the config stage, something like this could do the job ?

angular.module('myApp')
        .config(function(ngstompProvider){
            ngstompProvider
                .url('/ws')
                .credential('login', 'password')
                .heartbeat(20000, 0) // .heartbeat(outgoing, incoming)
        });
josephrace commented 8 years ago

Yes, that could work.

davinkevin commented 8 years ago

Done in a43c52d602468ca62190bf63eedd71df49bcc929

Hope that will help you.

If in the futur I can't do the modification, don't forget, you can do a PR...

You close the issue if it's ok for you ;)

josephrace commented 8 years ago

Great, thanks for the quick response! Will definitely submit a PR if I discover anything else in future.