You can't hide keys that are transmitted to the client and are accessible in JavaScript.
However, what you can do is restrict who can read and write to channels by using an auth_key
along with your publish and subscribe keys. PubNub recently released the PubNub Access Manager to enable this. The auth_key
will be specific to each user.
- The users
auth_key
will allow that user to read and write to their own private channel. You will need to set permissions so that nobody else will be able to read or write to this channel.
- The users
auth_key
will give them permission to read and write to their own public channel. Others can read, but cannot write to this channel.
Details on exactly how to do this should probably be asked in another question. The PAM getting started guide should be the best place to start.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…