Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
This gem allows message async message calls to subscribed listeners. Messages can be fired between ruby objects or to websocket connections.
Add this line to your application's Gemfile:
gem 'sock-drawer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sock-drawer
Initialize a instance of the sock-drawer client
sock = Sock::Client.new(logger: Rails.logger, redis: redis)
Publish an event on a channel,
sock.pub("my message", channel: "my-channel")
or publish to all channels,
sock.pub("my message")
To capture the event in Javascript use something like,
var webSocket = new WebSocket("ws://" + location.hostname + ":8081/" + "my-channel");
webSocket.onmessage = function(event) {
console.log(event.data);
}
Create a class to handle redis events like,
class MyListener
include Sock::Subscriber
on 'echo' do |msg|
msg
end
end
Then register your listener with the server
Sock::Server.new(listener: MyListener)
Whenever an event is fired on the sock-hook/echo
channel the block will be executed.
you can configure your sock server to run as a rake task like,
namespace :sock do
desc 'start the sock-drawer server to manage socket connections'
task :server do
Sock::Server.new.start!
end
end
Then run it with rake sock:server
Current supported configuration options:
keyword arg | default |
---|---|
name | 'sock-hook' |
logger | Logger.new(STDOUT) |
socket_params | { host: '0.0.0.0', port: 8020 } |
mode | 'default' |
listener | N/A |
And you are good to go!
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)if you are going to contribute, I hope you run the tests at least once -- hopefully many times. to run the tests, you must have redis-server running in the background with default configuration.
FAQs
Unknown package
We found that sock-drawer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.