dwyl / dwyl/hapi-socketio-redis-chat-example

Send chat message from command line

Open
#81 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Elm
Stars
360
Forks
72
PR merge metrics
No merged PRs in 30d

Description

Wanted the ability to send messages from the command line, so wrote this little script. feel free to add to the project, the time stamp is screwed up, not sure what the fix is.
```
#!/usr/bin/python2
#
# talk to chat from the command line
# by James Dickens
#
import time
import redis
import sys
redis_host="192.168.1.42"

t = str(time.time()).replace('.','')
count = len(sys.argv)
if count < 3:
print "Usage: "
print sys.argv[0], "username message"
sys.exit()

r = redis.Redis(redis_host)
mess ='{"m":"%s","t":%s,"n":"%s"}'%(sys.argv[2],t,sys.argv[1])
r.publish("chat:messages:latest", mess)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.