|
@@ -1,9 +1,10 @@
|
|
|
class GaleneSocket
|
|
|
{
|
|
|
- constructor(connection) {
|
|
|
+ constructor(connection, host) {
|
|
|
this.OPEN = connection.connected;
|
|
|
this.connection = connection;
|
|
|
this.readyState = this.OPEN;
|
|
|
+ this.host = host;
|
|
|
|
|
|
this.connection.addHandler((iq) => {
|
|
|
const json_ele = iq.querySelector("json");
|
|
@@ -25,14 +26,14 @@ class GaleneSocket
|
|
|
close(code, reason) {
|
|
|
console.debug('GaleneSocket close', code, reason);
|
|
|
|
|
|
- this.connection.sendIQ($iq({type: 'set', to: this.connection.domain}).c('c2s', {xmlns: 'urn:xmpp:sfu:galene:0'}), (res) => {
|
|
|
+ this.connection.sendIQ($iq({type: 'set', to: this.host}).c('c2s', {xmlns: 'urn:xmpp:sfu:galene:0'}), (res) => {
|
|
|
if (this.onclose) this.onclose({code, reason});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
send(text) {
|
|
|
console.debug('GaleneSocket send', text);
|
|
|
- this.connection.sendIQ($iq({type: 'set', to: this.connection.domain}).c('c2s', {xmlns: 'urn:xmpp:sfu:galene:0'}).c('json', {xmlns: 'urn:xmpp:json:0'}).t(text), (res) => {
|
|
|
+ this.connection.sendIQ($iq({type: 'set', to: this.host}).c('c2s', {xmlns: 'urn:xmpp:sfu:galene:0'}).c('json', {xmlns: 'urn:xmpp:json:0'}).t(text), (res) => {
|
|
|
//console.debug('GaleneSocket send response', res);
|
|
|
});
|
|
|
}
|