I'm trying to write a xmpp implementation in Ruby for GCM CCS.
My code
require 'xmpp4r'
sender_jid = Jabber::JID.new('my_app_id#gcm.googleapis.com')
client = Jabber::Client.new(sender_jid)
client.connect('gcm.googleapis.com', 5235)
client.auth('auth_token')
after client.connect .... I get this error :
fatal: No live threads left. Deadlock?
Any ideas?
client.use_ssl = true
solves this
Related
I have got this problem with pyrogram
app = Client("session",
api_id,
api_hash,
bot_token)
How can i send message via bot not userbot ?
for using a bot and a userbot separately in same time you should do this :
#bot.on_message ...
your code
#app.on_message
your code
bot.start()
app.run()
or you can use 2 threads with using threading mudule.
I am trying to receive private meesages from SocketIO stream. I have IP address but I am getting problem in connection. Also, if connection will happen then also I have to authorize the connection using token then only I can get the messages. I dont how to implement this as I am vey much New to this thing.
I have tried with the following code from the stack overflow but no luck yet.
Also, can anybody tell me which library is best to use:
SocketIO4Net.Client
SocketIOClientDotNet
I am using 2nd one.
var socket = IO.Socket("myip");
socket.On("xx", async (data) =>
{
var test = await Update(data.ToString());
});
Can anybody help me on this. I am .net server side developer.Thanks in advance!!
I have been following this link to understand how to use HttpClient to call a Web API Method.
https://www.tutorialsteacher.com/webapi/consuming-web-api-in-dotnet-using-httpclient
The code of interest in the article is below with ‘client’ being the HttpClient object:
client.BaseAddress = new Uri("http://localhost:60464/api/"); //HTTP GET
var responseTask = client.GetAsync("student");
responseTask.Wait();
var result = responseTask.Result;
Error results as follows:
System.AggregateException: 'One or more errors occurred. (Failed to connect to localhost/127.0.0.1:443)'
Please understand my background in networking, IIS and the like is very limited.Most of my time is spent in code and SQL Sprocs. This is a personal project so I have to get this setup myself
If I replace localhost with my machines IP I get the following error:
One or more errors occurred. (java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.)'
So two questions:
How do I install this needed certificate or settings or otherwise (again no idea about this configuration network stuff) but I do have IIS up and running with the Web API hosted and working
If using ‘localhost’ is not supposed to work, what might be the reason this article is using it?
This is only for a personal development machine, yes at some point I am going to want it to work in the real world but for now I just need to get some ‘hello world’ stuff going before the end of times.
The following method returns a 422 HTTP status code when I attempt to create a Dyno with the heroku app api:
client = PlatformAPI.connect_oauth(API_KEY)
dyno_interface = PlatformAPI::Dyno.new(client)
begin
dyno_interface.create('my-cool-app', {"command" => " bin/rails server -p
$PORT -e $RAILS_ENV", "size" => "hobby", "type"=> "run"})
rescue => e
resp = e.response
end
It fails with the message: Requested type Hobby is not available. Please use Free.
If it matters, I've tried on different versions of the Ruby client, (version 2.0.0). Also, my app does not currently have a Procfile but I was unsure if this would matter.
TLDR: How can I automatically create Dynos of type Hobby via the Heroku API (preferably in Ruby).
Never did figure out how to change the dyno type from Ruby so instead we ended up calling bash/Heroku CLI from ruby.
Still interested if anyone knows how to do this from Ruby.
I have stream of data coming to me via an http hit. I want to update data in realtime. I have started pushing HTTP hits data to a redis pubsub. Now I want to show it to users.
I want to update user's screen as soon as I get some data on redis channel. I want to use ruby as that is the language I am comfortable with.
I would use Sinatra's "stream" feature coupled with EventSource on the client side. Leaves IE out, though.
Here's some mostly functional server side code pulled from https://github.com/redis/redis-rb/blob/master/examples/pubsub.rb (another option is https://github.com/pietern/hiredis-rb):
get '/the_stream', provides: 'text/event-stream' do
stream :keep_open do |out|
redis = Redis.new
redis.subscribe(:channel1, :channel2) do |on|
on.message do |channel, msg|
out << "data: #{msg}\n\n" # This is an EventSource message
end
end
end
end
Client side. Most modern browsers support EventSource, except IE:
var stream = new EventSource('/the_stream');
stream.onmessage = function(e) {
alert("I just got this from the server: " + e.data);
}
As of I know you can do this via Faye check this link out
There are couple approach If you wish you can try
I remember myself building a Long Polling server using thin and sinatra to achieve something like this now If u wish you can do the same
I know of few like this and this flash client that you can use to connect directly to redis
There is EventMachine Websocket implementation u can use and hook it up with HTML 5 and Flash for non HTML 5 browser
Websocket-Rack
Other Approach you can try just a suggestion since most of them arent written in ruby
Juggernaut ( I dont think it based on Redis Pub-sub Thing also there used to ruby thing earlier not sure of now)
Socket.io
Webd.is
NULLMQ Not a redis pub sub but this is Zero MQ implementation in javascript
There are few other approach you can find If u google up :)
Hope this help