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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user