Comments (14)
I just tried this now:
alert("Final pusher state: " + pusher.connection.state);
and outputs 'failed'. But the event is not triggered...
from pusher-js.
Hiya. Thanks a lot for reporting this. I'm looking into it.
from pusher-js.
By the way, which version of IE are you using?
from pusher-js.
I think I tried it with both IE9 and IE8 (flash enabled: works; flash disabled: doesn't) through browserstack.com
from pusher-js.
Could you tell me which version of the Pusher JavaScript library you are using? Also, are there any error messages displayed in your browser console?
from pusher-js.
Sorry. Another question: when do you bind to the failed
state? Would you mind posting a little more of your code? It would be useful to see the code from the Pusher object instantiation to the bind?
from pusher-js.
Hi, I use CoffeeScript and have a static object that holds a method to start listening to different pusher events.
@CarHistoryLookupForm =
messages_received: 0
received_anything: false
pusher: null
channel: null
start_listening: (channel_id) ->
@pusher = new Pusher('xxxxxxx')
@pusher.connection.bind 'failed', @unsupported
@channel = @pusher.subscribe(channel_id)
@channel.bind 'start', (data) => @handle_start(data)
@channel.bind 'success', (data) => @handle_succes(data)
@channel.bind 'failure', (data) => @handle_failure(data)
@channel.bind 'failure_unknown_reg_number', (data) => @handle_reg_number_failure(data)
# ....
handle_failure: (data={}) ->
@disconnect_pusher
@hide_loader()
@show_failure()
I call the method from an AJAX response that gets executed (Rails remote form)
CarHistoryLookupForm.start_listening('<%=@channel%>')
if you're not familiar with CoffeeScript, please note that @
means this.
and ->
or =>
is similar to function() {
from pusher-js.
Great - thank you. Which version of the Pusher JavaScript library are you on?
from pusher-js.
I was using this one: "http://js.pusher.com/1.11/pusher.min.js"
but I also tried with latest, 1.12 and had the same issue
from pusher-js.
Great - thank you. I'll be in touch after I've investigated further.
from pusher-js.
Hmm. I'm a bit baffled. I tried a test with the following code:
var pusher = new Pusher('insertkeyhere');
pusher.connection.bind("failed", function() {
console.log("failed!");
});
in IE8 running both on a local VM and in browserstack.com and the failed
event was emitted correctly. I can't see any important differences between your code and my test code. Is there any way you could send me the URL of your page so I can look at the page source and view any debug console errors that might be getting thrown?
Thanks.
from pusher-js.
As we agreed via email, I'm going to close this because we can't reproduce it in isolation from your app.
from pusher-js.
Hello!
I have exactly the same problem. I can read in docs (https://pusher.com/docs/client_api_guide/client_connect) I should bind 'error'
So I do the following:
pusher.connection.bind('error', function (error) {
console.log('Service error');
});
pusher.connection.bind('failed', function (error) {
console.log('service failed');
});
pusher.connection.bind('state_change', function(states) {
console.log("Pusher's current state is " + states.current);
});
And when I connect / disconnect my internet connection the only console log I can see is "Pusher's current state is ...". Should I do something else?
Thanks in advance!
from pusher-js.
From https://pusher.com/docs/client_api_guide/client_connect:
A state of failed
means:
Pusher is not supported by the browser. This implies that WebSockets are not natively available, Flash is not available, and an HTTP-based transport could not be found.
This will only every happy at the very start of the connection/Pusher
instantiation process.
A state of error
occurs:
When connection limits are reached additional connections over the limit will be rejected
Additionally, this may happen if you provide the incorrect application key. This also only happens at the very start of the connection/Pusher
instantiation process.
when I connect / disconnect my internet connection the only console log I can see is "Pusher's current state is ..."
As above, this is because both failed
and error
are initial failure states and you shouldn't expect to see them during the reconnection cycle.
I hope this clarifies things.
from pusher-js.
Related Issues (20)
- Error `Unable to resolve module @react-native-community/netinfo` HOT 1
- TypeError: Object(...) is not a function at Object.randomInt HOT 10
- PWA HOT 1
- Constant connection state changes when using other than ws transports HOT 3
- Not actuall stats HOT 6
- Pusher-JS doesnt play well with NextJS 14 : Uncaught SyntaxError: Unexpected token ':' HOT 2
- Providing Custom Handler, Internal Endpoint Still Calls
- Pusher client is not binding correctly on presence channels but on public ones yes HOT 2
- Pusher websocket URL triggering events and sending data HOT 1
- This is a test.
- testing
- PageSpeed Insights Failed: net::ERR_NAME_NOT_RESOLVED HOT 1
- Feature - Attach additional params in `subscribe` method for channel auth
- test123
- test bracatinga
- test samambaia
- test araucaria
- test pinus grandis
- test hortencia
- test hoverboat
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pusher-js.