chasepeeler / nephp2016_websockets

0 stars 0 forks source link

Uncaught ReferenceError: ab is not defined #1

Open junior-ch-rc opened 3 years ago

junior-ch-rc commented 3 years ago

I'm trying to put this project to work and when I access the push.html page, I have this error:

Uncaught ReferenceError: ab is not defined
    at push.html:10
(anonymous) @ push.html:10

Before, I was having troubles with autobahn, so a found the file autobahn.min.js and attached to the project. I'm a beginner and learning how real-time applications work in php using ratchet, so I appreciate any help.

chasepeeler commented 3 years ago

My guess would be that the version of autobahn you found is a different version that the one I'm referencing? You need to make sure it's a client that supports WAMP v1, not WAMP v2.

Honestly, this might not be the best tutorial to follow as it's over four years old, and WAMP v2 was already out there back when I did this. That being said, if all you want to do is be able to push notifications to JS pages via websockets, it does work and is pretty simple. Since I put this together, I've switched to another JS library, Wampy: https://github.com/KSDaemon/wampy.js You'll need to make sure you get an older version for WAMP v1 though: https://cdn.jsdelivr.net/gh/KSDaemon/wampy.js@v0.1.0/src/wampy.js

The way I'm using it in my apps I've put a lot of wrappers around it, but it looks like it's basically used as follows:

wamp = new Wampy('/pusher'); wamp.subscribe('topic',callback);

You can get more details on the projects page.