You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JitsiConnection.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var JitsiConference = require("./JitsiConference");
  2. var XMPP = require("./modules/xmpp/xmpp");
  3. function wrapper()
  4. {
  5. var jitsiconnectioninstance = new JitsiConnection();
  6. this.a = jitsiconnectioninstance.a();
  7. }
  8. /**
  9. * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
  10. * JitsiConference interface.
  11. * @param appID identification for the provider of Jitsi Meet video conferencing services.
  12. * @param token secret generated by the provider of Jitsi Meet video conferencing services.
  13. * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client.
  14. * @param options Object with properties / settings related to connection with the server.
  15. * @constructor
  16. */
  17. function JitsiConnection(appID, token, options) {
  18. this.appID = appID;
  19. this.token = token;
  20. this.options = options;
  21. this.xmpp = new XMPP(options);
  22. }
  23. /**
  24. * Connect the client with the server.
  25. * @param options {object} connecting options (for example authentications parameters).
  26. */
  27. JitsiConnection.prototype.connect = function (options) {
  28. if(!options)
  29. options = {};
  30. this.xmpp.connect(options.id, options.password);
  31. }
  32. /**
  33. * Disconnect the client from the server.
  34. */
  35. JitsiConnection.prototype.disconnect = function () {
  36. this.xmpp.disconnect();
  37. }
  38. /**
  39. * This method allows renewal of the tokens if they are expiring.
  40. * @param token the new token.
  41. */
  42. JitsiConnection.prototype.setToken = function (token) {
  43. this.token = token;
  44. }
  45. /**
  46. * Creates and joins new conference.
  47. * @param name the name of the conference; if null - a generated name will be provided from the api
  48. * @param options Object with properties / settings related to the conference that will be created.
  49. * @returns {JitsiConference} returns the new conference object.
  50. */
  51. JitsiConnection.prototype.initJitsiConference = function (name, options) {
  52. return new JitsiConference({name: name, config: options, connection: this});
  53. }
  54. /**
  55. * Subscribes the passed listener to the event.
  56. * @param event {JitsiConnectionEvents} the connection event.
  57. * @param listener {Function} the function that will receive the event
  58. */
  59. JitsiConnection.prototype.addEventListener = function (event, listener) {
  60. this.xmpp.addListener(event, listener);
  61. }
  62. /**
  63. * Unsubscribes the passed handler.
  64. * @param event {JitsiConnectionEvents} the connection event.
  65. * @param listener {Function} the function that will receive the event
  66. */
  67. JitsiConnection.prototype.removeEventListener = function (event, listener) {
  68. this.xmpp.removeListener(event, listener);
  69. }
  70. module.exports = JitsiConnection;