Wrap message receiver for minimum api exposure
Initializing a message receiver opens the socket and starts listening right away rather than requiring a separate call to connect. The only other publicly accessible method is to query the socket status. // FREEBIE
This commit is contained in:
parent
18433419c9
commit
b0603bc91a
3 changed files with 24 additions and 7 deletions
|
@ -43,15 +43,14 @@
|
|||
function init() {
|
||||
if (!textsecure.registration.isDone()) { return; }
|
||||
|
||||
// initialize the socket and start listening for messages
|
||||
messageReceiver = new textsecure.MessageReceiver(window);
|
||||
window.addEventListener('contact', onContactReceived);
|
||||
window.addEventListener('receipt', onDeliveryReceipt);
|
||||
window.addEventListener('message', onMessageReceived);
|
||||
window.addEventListener('receipt', onDeliveryReceipt);
|
||||
window.addEventListener('contact', onContactReceived);
|
||||
window.addEventListener('group', onGroupReceived);
|
||||
window.addEventListener('sent', onSentMessage);
|
||||
window.addEventListener('error', onError);
|
||||
messageReceiver.connect();
|
||||
// initialize the socket and start listening for messages
|
||||
messageReceiver = new textsecure.MessageReceiver(window);
|
||||
}
|
||||
|
||||
function onContactReceived(contactInfo) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue