Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


	<title>WebRTC with SkylinkJS</title>
	<script src="//"></script>

    <a href="">More about SkylinkJS</a>
    <input type="text" id="name" placeholder="My name" autofocus />
    <button onclick="setName()">Set my name</button>
    <button onclick="joinRoom()">Join room</button>
    <button onclick="leaveRoom()">Leave room</button>
    <input type="text" id="message" placeholder="My message" />
    <button onclick="sendMessage()">Send message</button>
    <a href="" target="_blank">Open a new tab to chat with yourself</a>
  <div id="container">
    <div id="chatbox"></div>


                header {
  background: #eee;
  padding: 20px;
  margin-bottom: .4em;
  font-family: Helvetica, Arial, sans-serif;

header a:first-child {
  float: right;
  margin: 0 0 20px 30px;

#container {
  position: relative;
  border: 1px #ddd solid;
  height: 180px;
  overflow-y: auto;

#chatbox {
  position: absolute;
  bottom: 0px;

.action {
  font-style: italic;
  color: gray;

.you {
  font-weight: bold;


                var skylink = new Skylink();

skylink.on('peerJoined', function(peerId, peerInfo, isSelf) {
  var user = 'You';
  if(!isSelf) {
    user = || peerId;
  addMessage(user + ' joined the room', 'action');

skylink.on('peerUpdated', function(peerId, peerInfo, isSelf) {
  if(isSelf) {
    user = || peerId;
    addMessage('You\'re now known as ' + user, 'action');

skylink.on('peerLeft', function(peerId, peerInfo, isSelf) {
  var user = 'You';
  if(!isSelf) {
    user = || peerId;
  addMessage(user + ' left the room', 'action');

skylink.on('incomingMessage', function(message, peerId, peerInfo, isSelf) {
  var user = 'You',
      className = 'you';
  if(!isSelf) {
    user = || peerId;
    className = 'message';
  addMessage(user + ': ' + message.content, className);

skylink.init('cd7819c8-8513-4c3f-8ed1-bc1a35bc13ba'); // Get your own key at

function setName() {
  var input = document.getElementById('name');
    name: input.value

function joinRoom() {

function leaveRoom() {

function sendMessage() {
  var input = document.getElementById('message');
  input.value = '';;

function addMessage(message, className) {
  var chatbox = document.getElementById('chatbox'),
    div = document.createElement('div');
  div.className = className;
  div.textContent = message;