pschat

PURPOSE

pschat.ps1 uses the PoShRabbit module to add real-time chat capabilities to any PowerShell session.

OVERVIEW

By dot-sourcing the pschat.ps1 file, several new functions are added to your session that allow you to send broadcast and private messages to anyone else connected to the same server and exchange.

PREREQUISITES

To run this sample you must have:
  • PoShRabbit installed.
  • an accessible RabbitMQ server; this example assumes the server does not require authentication.

RUNNING THE SAMPLE

Modify the RabbitMQ configuration in the config.ps1 file.

Open a new PowerShell session and dot-source the pschat.ps1 file:
PS> . ./pschat.ps1

You can supply a name to use over chat if you wish; by default the sample uses the value of the USERNAME environment variable:
PS> . ./pschat.ps1 beefarino

Dot-sourcing pschat.ps1 starts chat consumers and adds these new functions to your PowerShell session:
  • send-chat
  • stop-chat
  • start-chat

Use send-chat to send a broadcast message:
PS> send-chat "hello everybody!"
beefarino says: hello everybody!

Or use the -recipient parameter to send a more private message:
PS> send-chat "dude, srsly, invest in some deodorant"  -recipient dirtyharry

send-chat is pipeline-aware, so you can be really annoying if you want:
PS> dir c:\ -recurse | send-chat;
beefarino says: c:\junk.txt
beefarino says: c:\stuff.txt
# ... ad nauseum

Use stop-chat when you get sick of chats:
PS> stop-chat

Until you realize how alone you really are, then call start-chat to reconnect:
PS> start-chat

NOTES

Chat messages show up wherever the cursor is located in the console. This can be really irritating but then again, this is just an example, so....that's all I have to say about that.

Last edited Nov 23, 2010 at 8:39 PM by beefarino, version 1

Comments

No comments yet.