Comments (19)
hmm.. looks pretty boilerplate. how often do you get this, and how fast are you publishing ?
from ruby.
@geremyCohen I've isolated the issue a bit more. Check out the updated code above.
from ruby.
Are you using any other EM-based code that may be stopping/restarting the reactor ? And please tell me how often it occurs, how fast you are publishing?
from ruby.
ok, thanks, I didnt get the page update until just now.
from ruby.
This is strange. Seems like some sort of scoping issue on the callback.
# This works
@@pn.here_now(
:channel => 'stacks',
:callback => method(:puts)
)
but
# This does not work
@@pn.here_now(
:channel => 'stacks',
:callback => method(:callback)
)
from ruby.
wait, thats not it. still researching...
from ruby.
@geremyCohen thanks... I can't seem to figure it out. Do you have a hack that would work in the interim?
from ruby.
I see the issue, and I will see if I can find a workaround or fix for you...
from ruby.
Does your app require EM anywhere else?
from ruby.
Not in any of my files. Here are my gem's
Gems included by the bundle:
* activesupport (4.0.0)
* addressable (2.3.5)
* ansi (1.4.3)
* atomic (1.1.10)
* aws-sdk (1.11.3)
* builder (3.2.2)
* bundler (1.3.5)
* commander (4.1.3)
* cookiejar (0.3.0)
* em-http-request (1.1.0)
* em-socksify (0.3.0)
* eventmachine (1.0.3)
* factory_girl (4.2.0)
* hashie (2.0.5)
* highline (1.6.19)
* hoe (3.6.3)
* http_parser.rb (0.6.0.beta.2)
* i18n (0.6.4)
* json (1.8.0)
* macaddr (1.6.1)
* minitest (4.7.5)
* minitest-reporters (0.14.20)
* multi_json (1.7.7)
* nokogiri (1.5.10)
* powerbar (1.0.11)
* promise (0.3.0)
* pubnub (3.3.0.7)
* rack (1.5.2)
* rack-protection (1.5.0)
* rack-test (0.6.2)
* rake (10.1.0)
* shotgun (0.9)
* simple_mock (0.0.2)
* sinatra (1.4.3)
* systemu (2.5.2)
* terminal-table (1.4.5)
* test-unit (1.2.3)
* thread_safe (0.1.0)
* tilt (1.4.1)
* tzinfo (0.3.37)
* uuid (2.3.7)
* uuidtools (2.1.4)
* yajl-ruby (1.1.0)
from ruby.
My Gemfile
is probably more helpful:
source 'https://rubygems.org'
gem 'aws-sdk', '~> 1.0'
gem "pubnub", "~> 3.3.0.7"
gem 'sinatra'
gem 'shotgun'
gem 'commander'
gem 'terminal-table'
gem 'promise'
group :test do
gem "test-unit", "1.2.3"
gem "rack-test"
gem "simple_mock", "~> 0.0.2"
gem "factory_girl", "~> 4.0"
gem "minitest-reporters"
end
from ruby.
The issue occurs because we are chaining calls. This is an issue with this version of the gem. Our new gem is in closed beta that lets you chain stuff... let me know if you'd be interested in checking it out.
In the meantime, the easiest workaround for you is to use our blocking publish for your publish: https://github.com/pubnub/ruby/blob/master/3.3/app/models/blocking_pub.rb
This way, there is no race condition between the two operations.
But real solution is in new version, let me know if you are interested in checking it out.
geremy
from ruby.
@geremyCohen can I ask why callbacks are used at all? I don't really see the reason for non-blocking in the case of here_now
or publish
at least...
from ruby.
The new gem lets you choose whether or not to use callbacks or blocks, and whether to block or not in the response. :)
from ruby.
In general, if you are concerned about server response before continuing, you can block and wait for it and handle it as it happens. Otherwise, if you choose to be fully async and not block using callbacks, you can do that as well.
from ruby.
@geremyCohen eta on the new gem?
from ruby.
I can send it to you... contact us at support @ pubnub and we'll set you up (its a closed beta)
from ruby.
done.
from ruby.
cool. we also tested your code on it successfully. I'll followup shortly offline via email.
from ruby.
Related Issues (20)
- Publishing message error HOT 7
- Unsubscribe? HOT 4
- Exception inside SubscribeCallback is getting ignored
- presence method does not get a callback on join events HOT 7
- "less than 100ms" HOT 4
- PubNub 3.4 for Ruby Released HOT 3
- Hardcoded log file HOT 4
- uninitialized constant Pubnub::Configuration::PUBNUB_VERSION HOT 8
- This application keeps requesting messages from the database forever HOT 5
- Synchronous publish? HOT 9
- Multi-process access in Heroku environment causes PubNub initialization to occasionally fail HOT 7
- Problems with PAM ttl in 3.5.0beta HOT 2
- 3.5.0 Release Candidate Available
- Logger invocations should use progname HOT 4
- event machine not initialized exception HOT 2
- Message object does allow values to be arrays HOT 3
- MXing with Ruby
- Publish on multiple channels doesn't work HOT 4
- Retrieve message uuid from ruby api HOT 6
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 ruby.