How to use the @xmpp/jid.JID function in @xmpp/jid

To help you get started, we’ve selected a few @xmpp/jid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / xmpp__jid / xmpp__jid-tests.ts View on Github external
import { JID } from '@xmpp/jid';

/*
 * All return an instance of JID.JID, the new operator is optional.
 */
let addr = new JID('alice@wonderland.net/rabbithole');          // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole');    // BEST; see section on escaping below

/*
 * local
 */
addr.local = 'alice';
addr.local;      // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice

/*
 * domain
 */
addr.domain = 'wonderland.net';
addr.domain;      // wonderland.net
// same as
github DefinitelyTyped / DefinitelyTyped / xmpp__jid / xmpp__jid-tests.ts View on Github external
import {JID} from '@xmpp/jid';

/*
 * All return an instance of JID.JID, the new operator is optional.
 */
let addr = new JID('alice@wonderland.net/rabbithole');          // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole');    // BEST; see section on escaping below

/*
 * local
 */
addr.local = 'alice';
addr.local;      // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice

/*
 * domain
 */
addr.domain = 'wonderland.net';
addr.domain;      // wonderland.net
// same as
github DefinitelyTyped / DefinitelyTyped / types / xmpp__jid / xmpp__jid-tests.ts View on Github external
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net

/*
 * resource
 */
addr.resource = 'rabbithole';
addr.resource;      // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole

addr.toString(); // alice@wonderland.net/rabbithole
addr.bare();     // returns a JID without resource

const some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise
github DefinitelyTyped / DefinitelyTyped / types / xmpp__jid / xmpp__jid-tests.ts View on Github external
import { JID } from '@xmpp/jid';

/*
 * All return an instance of JID.JID, the new operator is optional.
 */
let addr = new JID('alice@wonderland.net/rabbithole');          // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole');    // BEST; see section on escaping below

/*
 * local
 */
addr.local = 'alice';
addr.local;      // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice

/*
 * domain
 */
addr.domain = 'wonderland.net';
addr.domain;      // wonderland.net
github DefinitelyTyped / DefinitelyTyped / xmpp__jid / xmpp__jid-tests.ts View on Github external
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net

/*
 * resource
 */
addr.resource = 'rabbithole';
addr.resource;      // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole

addr.toString(); // alice@wonderland.net/rabbithole
addr.bare();     // returns a JID without resource

const some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise
github DefinitelyTyped / DefinitelyTyped / xmpp__jid / xmpp__jid-tests.ts View on Github external
import {JID} from '@xmpp/jid';

/*
 * All return an instance of JID.JID, the new operator is optional.
 */
let addr = new JID('alice@wonderland.net/rabbithole');          // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole');    // BEST; see section on escaping below

/*
 * local
 */
addr.local = 'alice';
addr.local;      // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice

/*
 * domain
 */
addr.domain = 'wonderland.net';
addr.domain;      // wonderland.net
github pazznetwork / ngx-chat / projects / pazznetwork / ngx-chat / src / lib / services / adapters / xmpp / plugins / roster.plugin.spec.ts View on Github external
providers: [
                XmppChatConnectionService,
                XmppChatAdapter,
                {provide: LogService, useValue: testLogService()},
                ContactFactoryService
            ]
        });

        chatConnectionService = TestBed.get(XmppChatConnectionService);
        chatConnectionService.client = xmppClientMock;
        contactFactory = TestBed.get(ContactFactoryService);
        chatAdapter = TestBed.get(XmppChatAdapter);
        logService = TestBed.get(LogService);
        chatAdapter.addPlugins([new RosterPlugin(chatAdapter, logService)]);

        chatConnectionService.userJid = new JID('me', 'example.com', 'something');
    });
github pazznetwork / ngx-chat / projects / pazznetwork / ngx-chat / src / lib / services / adapters / xmpp / xmpp-chat-adapter.service.spec.ts View on Github external
{provide: LogService, useValue: logService},
                ContactFactoryService
            ]
        });

        chatService = TestBed.get(ChatServiceToken);
        chatConnectionService = TestBed.get(XmppChatConnectionService);
        chatConnectionService.client = xmppClientMock;
        contactFactory = TestBed.get(ContactFactoryService);
        chatService.addPlugins([new MessageUuidPlugin(), new MessagePlugin(chatService, logService)]);

        contact1 = contactFactory.createContact('test@example.com', 'jon doe');
        contact2 = contactFactory.createContact('test2@example.com', 'jane dane');
        contacts = [contact1, contact2];

        chatConnectionService.userJid = new JID('me', 'example.com', 'something');
    });

@xmpp/jid

XMPP identifiers (JID) for JavaScript

ISC
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis

Popular @xmpp/jid functions