question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when overrides function sendPresence

See original GitHub issue

Dear jcbrand!

When I write plugin like this converse-js-plugin But It show error

TypeError: this.constructPresence is not a function
converse.connection.send(this.constructPresence(type, status_message));

And I Override other function It’s same problem My code

ChatBoxes: {
                onMessage: function (message) {
                    var $message = $(message),
                        contact_jid, $forwarded, $delay, from_bare_jid, from_resource, is_me, msgid,
                        chatbox, resource,
                        from_jid = $message.attr('from'),
                        to_jid = $message.attr('to'),
                        to_resource = Strophe.getResourceFromJid(to_jid);
                    console.log("[docaohuynh] FROM TO" + from_jid + " TO " + to_jid);
                    this._super.onMessage(message);
                }
            }

Error

TypeError: this.getChatBox is not a function
chatbox = this.getChatBox(contact_jid, $message.find('body').length > 0);

So What’s wrong with this code Tks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
docaohuynhcommented, Mar 18, 2016

Thanks! jcbrand. It work perfectly

1reaction
jcbrandcommented, Mar 17, 2016

When you call _super methods, you need to bind them to the correct context.

Like this:

    this._super.onMessage.apply(this, arguments);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mistake when overriding C++ virtual function - Stack Overflow
An overridden method has to have the same signature, i.e. argument and return types, as the base method. The compiler can notify you...
Read more >
Writing a plugin — Converse 10.0.0 documentation
We can override is as follows: */ XMPPStatus: { sendPresence: function (type, status_message, ... then no error will be raised if the plugin...
Read more >
strophe.js
error, Log a message at the Strophe.LogLevel.ERROR level. ... sendPresence, Helper function to send presence stanzas. ... User code can override this with....
Read more >
Jitsi meet plugin · Issue #7 · conversejs/community ... - GitHub
I am trying to get password of user in the jitisInitalize function. but its undefine. could you help me ? The text was...
Read more >
Compiler Error CS0505 - Microsoft Learn
'member1': cannot override because 'member2' is not a function. A class declaration attempted to override a non-method in a base class.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found