Socket.io Uncaught TypeError: Cannot read property 'apply' of undefined

A particular event doesn’t work in my program where I am using socket.io. The rest works fine. This is where the problem occurs:

First html file:

 socket.on('connect', () => {socket.emit('phone', 'phone');});

Server file:

io.on('connection', function(socket){ 
   io.on('phone', function(socket, data){ 
      io.emit('stuurbedrijfsnaam', 'stuurbedrijfsnaam'); 
   }); 
});

2nd html file:

socket.on('stuurbedrijfsnaam', function(socket){
    socket.emit('stuurbedrijfsnaam',bedrijfsnaam) 
})

This is the full error given in the console:

index.js:83 Uncaught TypeError: Cannot read property 'apply' of undefined
at r.emit (index.js:83)
at r.onevent (index.js:83)
at r.onpacket (index.js:83)
at r.<anonymous> (index.js:83)
at r.emit (index.js:83)
at r.ondecoded (index.js:83)
at a.<anonymous> (index.js:83)
at a.r.emit (index.js:83)
at a.add (index.js:83)
at r.ondata (index.js:83)
at r.<anonymous> (index.js:83)
at r.emit (index.js:83)
at r.onPacket (index.js:83)
at r.<anonymous> (index.js:83)
at r.emit (index.js:83)
at r.onPacket (index.js:83)
at r.onData (index.js:83)
at WebSocket.ws.onmessage (index.js:83)

It references index.js:83, which is inside a folder made by socket.io itself. There are lines 81, 82 and 83:

Backoff.prototype.setJitter = function(jitter){
    this.jitter = jitter;
    };

Hope I gave enough resources. It would be cool if someone’s help me out. Thanks!

172 thoughts on “Socket.io Uncaught TypeError: Cannot read property 'apply' of undefined”

  1. You actually make it seem so easy with your presentation but
    I find this topic to be really something which I think I would
    never understand. It seems too complex and very broad for me.
    I’m looking forward for your next post, I’ll try
    to get the hang of it!

    Reply
  2. Terrific work! That is the type of information that should be shared
    across the internet. Disgrace on the seek
    engines for now not positioning this post higher!

    Come on over and consult with my web site .
    Thank you =)

    my site Ace333 pc

    Reply
  3. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my
    blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for quite
    some time and was hoping maybe you would have some experience with
    something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

    Feel free to surf to my blog :: rollex11 game list [https://mega888sg.com/rollex11/]

    Reply
  4. Good ? I should certainly pronounce, impressed with your
    website. I had no trouble navigating through all the tabs and related information ended up being truly
    easy to do to access. I recently found what
    I hoped for before you know it at all. Reasonably unusual.
    Is likely to appreciate it for those who add forums or anything, website theme .
    a tones way for your client to communicate. Nice task.

    Here is my site … Gorges Cream Review

    Reply
  5. Hi there! This is my 1st comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your articles.

    Can you recommend any other blogs/websites/forums that deal with the
    same subjects? Many thanks!

    Stop by my blog post Helio CBD

    Reply
  6. Hey! Someone in my Myspace group shared this site with us
    so I came to take a look. I’m definitely loving the information. I’m book-marking and will be
    tweeting this to my followers! Great blog and fantastic style and design.

    Also visit my web-site … walnut.ut.ac.ir

    Reply
  7. I happen to be commenting to let you be aware of what a fantastic discovery my girl encountered using your blog.
    She learned a good number of details, which include what it’s like to
    possess an excellent teaching style to let other folks without hassle know precisely some complicated issues.
    You truly exceeded my expectations. I appreciate you for supplying the precious, trusted, informative and even fun thoughts on the topic
    to Ethel.

    Look into my web site; VitaSilkLux Reviews

    Reply
  8. I am also writing to let you understand of the perfect discovery my friend’s princess gained reading your blog.
    She learned so many things, which include what it’s like to possess a very effective coaching nature to make certain people very easily fully grasp specific
    problematic topics. You actually exceeded our own desires.
    Many thanks for showing those invaluable, healthy,
    edifying and also cool tips on your topic to Emily.

    My page Alpha Extracts CBD Oil

    Reply
  9. Thank you so much for providing individuals with a very brilliant chance
    to read in detail from this blog. It can be very awesome
    and stuffed with a great time for me personally
    and my office acquaintances to visit your web site
    on the least thrice in one week to find out the newest secrets you have got.

    Not to mention, I am usually fulfilled considering the perfect tips you serve.
    Some two points in this article are certainly the best I’ve had.

    Feel free to visit my web blog – Green Earth CBD Gummies Review

    Reply
  10. I was curious if you ever considered changing the structure of
    your website? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.

    Youve got an awful lot of text for only having one or 2 pictures.
    Maybe you could space it out better?

    Take a look at my homepage: http://astravo.net.ru/

    Reply
  11. You are so awesome! I do not think I’ve truly read something like this before.
    So wonderful to find another person with a few original thoughts on this subject.
    Seriously.. thank you for starting this up. This web site is one thing that is needed on the internet, someone with a little originality!

    Also visit my website: Pellamore Cream

    Reply
  12. May I just say what a relief to uncover someone that truly understands what they’re
    discussing over the internet. You certainly understand how to bring
    a problem to light and make it important. A lot more people must read
    this and understand this side of the story. I was surprised you
    are not more popular since you definitely have the gift.

    Reply
  13. I’m curious to find out what blog platform you are utilizing?

    I’m having some small security problems with my latest site and I’d like to find something more safe.

    Do you have any suggestions?

    My web site … PeniSizeXL

    Reply
  14. Hi there just wanted to give you a quick heads up. The words in your content seem to be
    running off the screen in Firefox. I’m not sure if this is a
    format issue or something to do with internet browser compatibility but I figured I’d post to
    let you know. The design and style look great though!
    Hope you get the problem resolved soon. Cheers

    Feel free to visit my web-site – http://www.comptine.biz

    Reply
  15. you are truly a excellent webmaster. The web site loading speed is incredible.

    It kind of feels that you’re doing any distinctive trick.
    Furthermore, The contents are masterpiece.

    you’ve done a fantastic task on this topic!

    Reply
  16. Hi there, I found your website by the use of Google even as searching
    for a similar topic, your website came up, it seems to be good.

    I have bookmarked it in my google bookmarks.

    Hi there, simply became alert to your blog via Google, and located
    that it is really informative. I am going to be careful for brussels.
    I will be grateful if you proceed this in future. Lots
    of people might be benefited from your writing. Cheers!

    Reply
  17. Simply desire to say your article is as astounding. The clarity in your
    post is just nice and i could assume you are an expert on this subject.
    Fine along with your permission let me to snatch your feed to stay
    updated with coming near near post. Thanks a million and please continue the gratifying work.

    Reply
  18. First off I want to say excellent blog! I had a
    quick question that I’d like to ask if you don’t mind.
    I was curious to know how you center yourself and clear your head before writing.
    I have had trouble clearing my mind in getting my ideas out.

    I do take pleasure in writing however it just seems like the first 10 to 15 minutes are lost just trying to figure
    out how to begin. Any recommendations or hints?

    Cheers!

    Also visit my web page Keto Secret Ingredients

    Reply
  19. Hello there! This article couldn’t be written much better!
    Going through this article reminds me of my previous roommate!
    He continually kept preaching about this. I will send this article to him.

    Fairly certain he’ll have a great read. I
    appreciate you for sharing!

    Reply
  20. Hi there I am so delighted I found your website, I really found you by accident,
    while I was looking on Yahoo for something else, Nonetheless I am here now
    and would just like to say cheers for a marvelous post and a all round interesting blog (I also love
    the theme/design), I don’t have time to browse it all at the
    moment but I have bookmarked it and also included your RSS feeds, so when I have time I will be
    back to read much more, Please do keep up the
    great work.

    Check out my web-site vip5.moisait2021.ru

    Reply
  21. Great ? I should certainly pronounce, impressed with your
    site. I had no trouble navigating through all the tabs as well as related information ended up being truly simple to do to access.

    I recently found what I hoped for before you know it in the least.
    Quite unusual. Is likely to appreciate it for those who add forums or anything, web site theme .

    a tones way for your customer to communicate. Excellent task.

    Feel free to surf to my site http://23.95.102.216/viewtopic.php?id=56686

    Reply
  22. Good – I should definitely pronounce, impressed with your website.

    I had no trouble navigating through all tabs and related information ended up being truly easy to do to access.

    I recently found what I hoped for before you know it at all.
    Reasonably unusual. Is likely to appreciate it for those who
    add forums or something, website theme . a tones way for your client to communicate.
    Excellent task.

    Also visit my web site: 159.203.199.234

    Reply
  23. Pingback: fun free sex games