I downloaded the rails 3.0.x socky demo app from : https://github.com/socky/socky-example. I remade the application in Rails 2.3.x. Now i have the following problem and i can't find any answers about it: When i run my application and i run the socky server and when i try to post a message this is the output i'm getting from the socky server:
D, [2011-01-07T13:01:31.250592 #23820] DEBUG -- : Connection(2159099260) terminated
D, [2011-01-07T13:01:36.425515 #23820] DEBUG -- : Connection(2159088740) incoming
D, [2011-01-07T13:01:36.426217 #23820] DEBUG -- : Connection(2159088740) sending data {"type":"message","body":"You are not authorized to post messages"}
D, [2011-01-07T13:01:36.426442 #23820] DEBUG -- : Connection(2159088740) terminated
How can i authorize myself / other users to post messages?
Thanks...
First of all - Socky have it's own google group where it will be best to ask such a questions. Please see http://groups.google.com/group/socky-users.
And about your question: when you see "unauthorized" message then you probably didn't set "secret" variable in config, or this variable don't match the same variable in server and rails client(config.yml for socky-server and socky_hosts.yml for rails app)
Related
Do you know the reason or the method that cause this Error :
Open /path1/path2/ : invalid argument
It is response of a request , and response code is 500 (internal server error ) with above message.
The website use Ruby on rails and I think that error is related to ruby on rails code but I don't know what methods (maybe Open in Io )
I have a rails API-only app running in nginx with passenger. I'm trying to use Action Cable to set up a simple chat application in Flutter but I can't seem to get it to work correctly.
I am able to connect using the following:
channel = IOWebSocketChannel.connect("wss://my.domain/cable")
and see the following in my production.log when that happens:
Started GET "/cable" for [redacted] at 2019-03-14 19:44:09 +0000
Started GET "/cable" [WebSocket] for [redacted] at 2019-03-14 19:44:09 +0000
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: upgrade, HTTP_UPGRADE: websocket)
Doorkeeper::AccessToken Load (0.3ms) SELECT `oauth_access_tokens`.* FROM `oauth_access_tokens` WHERE `oauth_access_tokens`.`token` = '[redacted]' LIMIT 1
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
Registered connection (Z2lkOi8vYWdlbnQyNHg3L1VzZXIvMg)
So the connection seems to be made and successfully upgraded
I am then sending a subscribe command
channel.sink.add(json.encode({
"command": "subscribe",
"identifier": {"channel": "ConversationChannel", "conversation_id": "${conversation.id}"}
}));
I'm not sure if I should be seeing anything in the log files after this command is executed, but I don't. Nothing happens and there is no indication of any error in my production.log or my nginx error log. I set up some logging in the subscribe method of the ConversationChannel so it would at least output something to the production log when it is called, so I could test if it's at least even calling the subscribe command
class ConversationChannel < ApplicationCable::Channel
def subscribed
Rails.logger.info "test conversation subscribe"
reject && return unless current_user
stream_from "conversation_#{params[:conversation_id]}_channel"
end
...
end
but this does not appear in production.log so it would seem that the subscription command is not getting to where it is supposed to go.
I then tried using dart WebSocket using the code located here, which came from a conversation on github regarding connection states, to see if I could determine if the connection was coming back okay.
When I run that code with my domain I see the same successful connection in the production.log, but the connection actually times out with onerror TimeoutException after 0:00:15.000000: Future not completed which seems to indicate that the connection actually doesn't succeed after all, despite what it says in the log file.
What am I doing wrong here?
If I remember, when you're attempting to connect to a channel, your identifier has to be JSON stringified, as well as your whole JSON object. Take a look at this link:
https://thoughtbot.com/blog/talking-to-actioncable-without-rails
In particular:
const msg = {
command: 'subscribe',
identifier: JSON.stringify({
channel: 'SomeChannel',
}),
};
socket.send(JSON.stringify(msg));
Rails does the whole JSON parsing in the backend. See if this helps you out. I've had similar issues like this before, when attempting to connect the WebSockets, without the usage of their ActionCable npm library.
I am submitting a POST form with a variable that accepts text input. I'm having an issue where, if the variable contains the two words "select" and "from" in the variable in that order but not subsequent, it gives an error 500 on the site. I do this on my development site and don't have the issue.
Prod Server info:
Linux version 2.6.32-573.12.1.el6.x86_64
(mockbuild#c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313)
PHP Version 5.6.25
Dev Server info:
Linux version 3.13.0-93-generic (buildd#lgw01-13) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
PHP Version 5.5.9-1ubuntu4.20
Sample POST output where error occurs:
[question] => 010101010101010101010101010101select0101010101010101010101010101from
I receive a 500 internal error and am unsure where to find the log files to get more info. Where do I start looking to resolve this?
I have searched google for "POST SUBMIT input select from causes 500 internal server error" and much more to no avail.
Looks like it was the hosting firewall blocking certain keywords. We found that the keywords "delete " and " from " or "select " and " from " were being blocked from gaining access to the site. I'm adding some jQuery with regex to alert the user that specific keywords in certain orders cannot be used.
I'm open to any other suggestions for how to prevent this from occurring or what would be a better option.
I am using Nginx & Phusion Passenger for running Rails app. I got these errors in the access log:
I, [2015-07-11T02:21:16.369230 #12228] INFO -- : Started GET "/cgi-bin/chs/numreg/init" for 61.160.213.56 at 2015-07-11 02:21:16 -0400
F, [2015-07-11T02:21:16.382745 #12228] FATAL -- : ActionController::RoutingError (No route matches [GET] "/cgi-bin/chs/numreg/init"):
I tried to search the IP 61.160.213.56 over the google, I found this page: http://www.ipillion.com/ip/61.160.213.108
It said that: 61.160.213.108 is known for firewall alert, port scanning.
Could any one tell me what does it mean? Do I need to block this IP from my site?
It's port scanning, and sending lots of dummy URL which could be allowing attacker to login to Admin page.
I've seen the same ip using the same URL. Here are a few more similar IPS doing the same thing:
61.160.213.55
61.160.213.56
61.160.213.247
61.160.213.32
I get this kind of log when ever i start socky server
>> Thin web server (v1.2.11 codename Bat-Shit Crazy)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3001, CTRL+C to stop
Socky : sending : {"event":"socky:connection:established","connection_id":"1320836395810196"}
Socky : received : {"event":"socky:subscribe","channel":"bizcard-updated-2011nov09-115943","connection_id":"1320836395810196"}
Socky : sending : {"event":"socky:subscribe:failure","channel":"bizcard-updated-2011nov09-115943"}
I am using
gem 'socky-client', '0.5.0.beta1'
Actually I cant figure it out why socky:subscribe:failure ie socky is not able to subscribe.
I once ran it and the subscription is also successfully. But some how later on this kind of message is being displayed.
However Socky get the data put not able to send it
Socky : received : {"event"=>"event_name", "channel"=>"channel name", "timestamp"=>"1320837649", "data"=>"\"content_hash\"", "auth"=>"auth_string"}
I am not able to figure it out why socky is not able to send data to browser.
Looks like the channel name is to long :(
I just had the same error trying to make a channel name with 33 characters.. but when i shortened it to 24 it worked fine.
I hope that helps.