MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / sendPacket

Function sendPacket

map-chat/javascript/browserMqtt.js:30–45  ·  view source on GitHub ↗
(client, packet, cb)

Source from the content-addressed store, hash-verified

28}
29
30function sendPacket (client, packet, cb) {
31 try {
32 var buf = mqttPacket.generate(packet);
33 if (!client.stream.write(buf) && cb) {
34 client.stream.once('drain', cb);
35 } else if (cb) {
36 cb();
37 }
38 } catch (err) {
39 if (cb) {
40 cb(err);
41 } else {
42 client.emit('error', err);
43 }
44 }
45}
46
47function storeAndSend (client, packet, cb) {
48 client.outgoingStore.put(packet, function storedPacket (err) {

Callers 2

storeAndSendFunction · 0.85
browserMqtt.jsFile · 0.85

Calls 1

emitMethod · 0.80

Tested by

no test coverage detected