dwyl / dwyl/hapi-socketio-redis-chat-example
Send chat message from command line
Open
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
Assessment
This issue has not been assessed yet.