Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix client.connect() method to allow to pass additional headers (e.g. a client-id header in issue #32). The change is backwards compatible so that Web applications should not have to change their call to work.
- Loading branch information
Showing
8 changed files
with
185 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -5,3 +5,4 @@ data | ||
dist/test | dist/test | ||
TODO.txt | TODO.txt | ||
node_modules | node_modules | ||
doc/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,76 @@ | |||
(function() { | |||
module("Parse connect method arguments", { | |||
|
|||
setup: function() { | |||
// prepare something for all following tests | |||
myConnectCallback = function() { | |||
// called back when the client is connected to STOMP broker | |||
}; | |||
|
|||
myErrorCallback = function() { | |||
// called back if the client can not connect to STOMP broker | |||
}; | |||
|
|||
client = Stomp.client(TEST.url); | |||
|
|||
checkArgs = function(args, expectedHeaders, expectedConnectCallback, expectedErrorCallback) { | |||
var headers = args[0]; | |||
var connectCallback = args[1]; | |||
var errorCallback = args[2]; | |||
|
|||
deepEqual(headers, expectedHeaders); | |||
strictEqual(connectCallback, expectedConnectCallback); | |||
strictEqual(errorCallback, expectedErrorCallback); | |||
} | |||
} | |||
}); | |||
|
|||
test("connect(login, passcode, connectCallback)", function() { | |||
checkArgs( | |||
client._parseConnect("jmesnil", "wombats", myConnectCallback), | |||
|
|||
{login: 'jmesnil', passcode: 'wombats'}, | |||
myConnectCallback, | |||
undefined); | |||
}); | |||
|
|||
test("connect(login, passcode, connectCallback, errorCallback)", function() { | |||
checkArgs( | |||
client._parseConnect("jmesnil", "wombats", myConnectCallback, myErrorCallback), | |||
|
|||
{login: 'jmesnil', passcode: 'wombats'}, | |||
myConnectCallback, | |||
myErrorCallback); | |||
}); | |||
|
|||
test("connect(login, passcode, connectCallback, errorCallback, vhost)", function() { | |||
checkArgs( | |||
client._parseConnect("jmesnil", "wombats", myConnectCallback, myErrorCallback, "myvhost"), | |||
|
|||
{login: 'jmesnil', passcode: 'wombats', vhost: 'myvhost'}, | |||
myConnectCallback, | |||
myErrorCallback); | |||
}); | |||
|
|||
test("connect(headers, connectCallback)", function() { | |||
var headers = {login: 'jmesnil', passcode: 'wombats', vhost: 'myvhost'}; | |||
|
|||
checkArgs( | |||
client._parseConnect(headers, myConnectCallback), | |||
|
|||
headers, | |||
myConnectCallback, | |||
undefined); | |||
}); | |||
|
|||
test("connect(headers, connectCallback, errorCallback)", function() { | |||
var headers = {login: 'jmesnil', passcode: 'wombats', vhost: 'myvhost'}; | |||
|
|||
checkArgs( | |||
client._parseConnect(headers, myConnectCallback, myErrorCallback), | |||
|
|||
headers, | |||
myConnectCallback, | |||
myErrorCallback); | |||
}); | |||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.