Question regarding character input

I am trying to add the ability to turn echo off for character input through a
socket connection, e.g. so someone connected could type a password in and not
have it displayed as they type.

I have seen examples of doing this using the ruby-termios extension and I
tried this, using the socket as the terminal handle, it did not work.

Does anyone know of a way to accomplish this?

Any help would be appreciated!