npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tcp-emit-server

v0.0.3

Published

TCP Socket Server Based Event Emitter

Downloads

19

Readme

<meta property="og:image" content="https://avatars0.githubusercontent.com/u/6775201?s=400&amp;v=4" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="claytonbez/tcp-emit-server" /><meta property="og:url" content="https://github.com/claytonbez/tcp-emit-server" /><meta property="og:description" content="tcp-emit-server - A TCP Socket Based Event Emitter" />
<meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">

  <meta name="hostname" content="github.com">
<meta name="user-login" content="claytonbez">

  <meta name="expected-hostname" content="github.com">
<meta name="js-proxy-site-detection-payload" content="NzcxNTFmNTk0MmEwZmQ0MjZiMTczMzU3MzNmZTYyZGJlNzU4MWI3YWQ2ZGY2ODk4ZjgwNWVkYjg1OWI0MzYyZHx7InJlbW90ZV9hZGRyZXNzIjoiMTU0LjExOS41Ny4yMzAiLCJyZXF1ZXN0X2lkIjoiRTNERTo2ODZEOkMwNjRDNjoxNkZEQzQ4OjVCMzhFNTRCIiwidGltZXN0YW1wIjoxNTMwNDU1MzcyLCJob3N0IjoiZ2l0aHViLmNvbSJ9">

<meta name="enabled-features" content="UNIVERSE_BANNER,FREE_TRIALS,MARKETPLACE_INSIGHTS,MARKETPLACE_SEARCH,MARKETPLACE_INSIGHTS_CONVERSION_PERCENTAGES">
  <link href="https://github.com/claytonbez/tcp-emit-server/commits/master.atom" rel="alternate" title="Recent Commits to tcp-emit-server:master" type="application/atom+xml">

<link rel="canonical" href="https://github.com/claytonbez/tcp-emit-server/blob/master/README.md" data-pjax-transient>
  </div>

</div>

<div class="HeaderMenu d-flex flex-justify-between flex-auto">
  <div class="d-flex">
        <div class="">
          <div class="header-search scoped-search site-scoped-search js-site-search position-relative js-jump-to"

role="search combobox" aria-owns="jump-to-results" aria-label="Search or jump to" aria-haspopup="listbox" aria-expanded="true"

        <div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
          <ul class="d-none js-jump-to-suggestions-template-container">
            <li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item">
              <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center p-2 jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open" href="">
                <div class="jump-to-octicon js-jump-to-octicon mr-2 text-center d-none"></div>
                <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar" alt="" aria-label="Team" src="" width="28" height="28">

                <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden no-wrap css-truncate css-truncate-target">
                </div>

                <div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search">
                  <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
                    In this repository
                  </span>
                  <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
                    All GitHub
                  </span>
                  <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
                </div>

                <div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
                  Jump to
                  <span class="d-inline-block ml-1 v-align-middle">↵</span>
                </div>
              </a>
            </li>
            <svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-repo-octicon-template" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg>
            <svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-project-octicon-template" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
            <svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-search-octicon-template" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg>
          </ul>
          <ul class="d-none js-jump-to-no-results-template-container">
            <li class="d-flex flex-justify-center flex-items-center p-3 f5 d-none">
              <span class="text-gray">No suggested jump to results</span>
            </li>
          </ul>

          <ul id="jump-to-results" class="js-navigation-container jump-to-suggestions-results-container js-jump-to-suggestions-results-container" >
            <li class="d-flex flex-justify-center flex-items-center p-0 f5">
              <img src="https://assets-cdn.github.com/images/spinners/octocat-spinner-128.gif" alt="Octocat Spinner Icon" class="m-2" width="28">
            </li>
          </ul>
        </div>
  </label>
        </div>

      <ul class="d-flex pl-2 flex-items-center text-bold list-style-none" role="navigation">
        <li>
          <a class="js-selected-navigation-item HeaderNavlink px-2" data-hotkey="g p" data-ga-click="Header, click, Nav menu - item:pulls context:user" aria-label="Pull requests you created" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls" href="/pulls">
            Pull requests

Issues Marketplace Explore

  <div class="d-flex">
    
<a aria-label="You have no unread notifications" class="notification-indicator tooltipped tooltipped-s  js-socket-channel js-notification-indicator" data-hotkey="g n" data-ga-click="Header, go to notifications, icon:read" data-channel="notification-changed:6775201" href="/notifications">
    <span class="mail-status "></span>
    <svg class="octicon octicon-bell" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M13.99 11.991v1H0v-1l.73-.58c.769-.769.809-2.547 1.189-4.416.77-3.767 4.077-4.996 4.077-4.996 0-.55.45-1 .999-1 .55 0 1 .45 1 1 0 0 3.387 1.229 4.156 4.996.38 1.879.42 3.657 1.19 4.417l.659.58h-.01zM6.995 15.99c1.11 0 1.999-.89 1.999-1.999H4.996c0 1.11.89 1.999 1.999 1.999z"/></svg>
  <ul class="dropdown-menu dropdown-menu-sw">
    
  </ul>
</details>
<details class="details-overlay details-reset js-dropdown-details d-flex pl-2 flex-items-center">
  <summary class="HeaderNavlink name mt-1"
    aria-label="View profile and more"
    data-ga-click="Header, show menu, icon:avatar">
    <img alt="@claytonbez" class="avatar float-left mr-1" src="https://avatars0.githubusercontent.com/u/6775201?s=40&amp;v=4" height="20" width="20">
    <span class="dropdown-caret"></span>
  </summary>

  <ul class="dropdown-menu dropdown-menu-sw">
    <li class="dropdown-header header-nav-current-user css-truncate">
      Signed in as <strong class="css-truncate-target">claytonbez</strong>
    </li>

    <li class="dropdown-divider"></li>

    <li><a class="dropdown-item" href="/claytonbez" data-ga-click="Header, go to profile, text:your profile">
      Your profile
    </a></li>
    <li><a class="dropdown-item" href="/claytonbez?tab=stars" data-ga-click="Header, go to starred repos, text:your stars">
      Your stars
    </a></li>
      <li><a class="dropdown-item" href="https://gist.github.com/" data-ga-click="Header, your gists, text:your gists">Your gists</a></li>

    <li class="dropdown-divider"></li>

    <li><a class="dropdown-item" href="https://help.github.com" data-ga-click="Header, go to help, text:help">
      Help
    </a></li>

    <li><a class="dropdown-item" href="/settings/profile" data-ga-click="Header, go to settings, icon:settings">
      Settings
    </a></li>

    <li><!-- '"` --><!-- </textarea></xmp> --></option></form><form class="logout-form" action="/logout" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="b+m+ktiqeO3q2SVO9tdAvlcjcWN3+MIVG9+p3XNZuNn9iPB2QRAFqdPcahcFDdmKS9x8UiLxWp9eFnKiy7qdrQ==" />
      <button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
        Sign out
      </button>
    </form></li>
  </ul>
</details>
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="sr-only right-0" action="/logout" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="jRNFrMqkDEXcefAhYovyBYooR9/Xp0hyB+IMY56jsH4fcgtIUx5xAeV8v3iRUWsxltdK7oKu0PhCK9ccJkCVCg==" />
      <button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
        Sign out
      </button>
<div id="js-flash-container">
  <ul class="pagehead-actions">
    <div class="select-menu js-menu-container js-select-menu">
      <a href="/claytonbez/tcp-emit-server/subscription"
        class="btn btn-sm btn-with-count select-menu-button js-menu-target"
        role="button"
        aria-haspopup="true"
        aria-expanded="false"
        aria-label="Toggle repository notifications menu"
        data-ga-click="Repository, click Watch settings, action:blob#show">
        <span class="js-select-button">
            <svg class="octicon octicon-eye" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
            Unwatch
        </span>
      </a>
      <a class="social-count js-social-count"
        href="/claytonbez/tcp-emit-server/watchers"
        aria-label="1 user is watching this repository">
        1
      </a>

    <div class="select-menu-modal-holder">
      <div class="select-menu-modal subscription-menu-modal js-menu-content">
        <div class="select-menu-header js-navigation-enable" tabindex="-1">
          <svg class="octicon octicon-x js-menu-close" role="img" aria-label="Close" viewBox="0 0 12 16" version="1.1" width="12" height="16"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
          <span class="select-menu-title">Notifications</span>
        </div>

          <div class="select-menu-list js-navigation-container" role="menu">

            <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
              <svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"/></svg>
              <div class="select-menu-item-text">
                <input type="radio" name="do" id="do_included" value="included" />
                <span class="select-menu-item-heading">Not watching</span>
                <span class="description">Be notified when participating or @mentioned.</span>
                <span class="js-select-button-text hidden-select-button-text">
                  <svg class="octicon octicon-eye" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
                  Watch
                </span>
              </div>
            </div>

            <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
              <svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"/></svg>
              <div class="select-menu-item-text">
                <input type="radio" name="do" id="do_subscribed" value="subscribed" checked="checked" />
                <span class="select-menu-item-heading">Watching</span>
                <span class="description">Be notified of all conversations.</span>
                <span class="js-select-button-text hidden-select-button-text">
                  <svg class="octicon octicon-eye" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
                    Unwatch
                </span>
              </div>
            </div>

            <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
              <svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"/></svg>
              <div class="select-menu-item-text">
                <input type="radio" name="do" id="do_ignore" value="ignore" />
                <span class="select-menu-item-heading">Ignoring</span>
                <span class="description">Never be notified.</span>
                <span class="js-select-button-text hidden-select-button-text">
                  <svg class="octicon octicon-mute" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"/></svg>
                    Stop ignoring
                </span>
              </div>
            </div>

          </div>

        </div>
      </div>
    </div>
  <h1 class="public ">

claytonbez/tcp-emit-server

</div>
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
  <a itemprop="url" data-hotkey="g i" class="js-selected-navigation-item reponav-item" data-selected-links="repo_issues repo_labels repo_milestones /claytonbez/tcp-emit-server/issues" href="/claytonbez/tcp-emit-server/issues">
    <svg class="octicon octicon-issue-opened" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg>
    <span itemprop="name">Issues</span>
    <span class="Counter">0</span>
    <meta itemprop="position" content="2">

<a data-hotkey="g b" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /claytonbez/tcp-emit-server/projects" href="/claytonbez/tcp-emit-server/projects">
  <svg class="octicon octicon-project" viewBox="0 0 15 16" version="1.1" width="15" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
  Projects
  <span class="Counter" >0</span>

Permalink

type="button" aria-label="Switch branches or tags" aria-expanded="false" aria-haspopup="true">
  <i>Branch:</i>
  <span class="js-select-button css-truncate-target">master</span>
<div class="select-menu-modal">
  <div class="select-menu-header">
    <svg class="octicon octicon-x js-menu-close" role="img" aria-label="Close" viewBox="0 0 12 16" version="1.1" width="12" height="16"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
    <span class="select-menu-title">Switch branches/tags</span>
  </div>

  <div class="select-menu-filters">
    <div class="select-menu-text-filter">
      <input type="text" aria-label="Find or create a branch…" id="context-commitish-filter-field" class="form-control js-filterable-field js-navigation-enable" placeholder="Find or create a branch…">
    </div>
    <div class="select-menu-tabs">
      <ul>
        <li class="select-menu-tab">
          <a href="#" data-tab-filter="branches" data-filter-placeholder="Find or create a branch…" class="js-select-menu-tab" role="tab">Branches</a>
        </li>
        <li class="select-menu-tab">
          <a href="#" data-tab-filter="tags" data-filter-placeholder="Find a tag…" class="js-select-menu-tab" role="tab">Tags</a>
        </li>
      </ul>
    </div>
  </div>

  <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches" role="menu">

    <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">


        <a class="select-menu-item js-navigation-item js-navigation-open selected"
           href="/claytonbez/tcp-emit-server/blob/master/README.md"
           data-name="master"
           data-skip-pjax="true"
           rel="nofollow">
          <svg class="octicon octicon-check select-menu-item-icon" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"/></svg>
          <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text">
            master
          </span>
        </a>
    </div>

      <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-create-branch select-menu-item select-menu-new-item-form js-navigation-item js-new-item-form" action="/claytonbez/tcp-emit-server/branches" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="Ba33cceaczVs62y57QqqUciPrQxaqe207xM8hNV3dyUQRtnfDdfw/BquvxPuBJbGzvPeVBLTU3on+KeFMOLHkA==" />
      <svg class="octicon octicon-git-branch select-menu-item-icon" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 5c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v.3c-.02.52-.23.98-.63 1.38-.4.4-.86.61-1.38.63-.83.02-1.48.16-2 .45V4.72a1.993 1.993 0 0 0-1-3.72C.88 1 0 1.89 0 3a2 2 0 0 0 1 1.72v6.56c-.59.35-1 .99-1 1.72 0 1.11.89 2 2 2 1.11 0 2-.89 2-2 0-.53-.2-1-.53-1.36.09-.06.48-.41.59-.47.25-.11.56-.17.94-.17 1.05-.05 1.95-.45 2.75-1.25S8.95 7.77 9 6.73h-.02C9.59 6.37 10 5.73 10 5zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm0 12.41c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm6-8c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
        <div class="select-menu-item-text">
          <span class="select-menu-item-heading">Create branch: <span class="js-new-item-name"></span></span>
          <span class="description">from ‘master’</span>
        </div>
        <input type="hidden" name="name" id="name" class="js-new-item-value">
        <input type="hidden" name="branch" id="branch" value="master">
        <input type="hidden" name="path" id="path" value="README.md">
  <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
    <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">


    </div>

    <div class="select-menu-no-results">Nothing to show</div>
  </div>

</div>
<div class="BtnGroup float-right">
  <a href="/claytonbez/tcp-emit-server/find/master"
        class="js-pjax-capture-input btn btn-sm BtnGroup-item"
        data-pjax
        data-hotkey="t">
    Find file
  </a>
  <clipboard-copy for="blob-path" class="btn btn-sm BtnGroup-item">
    Copy path
  </clipboard-copy>
</div>
<div id="blob-path" class="breadcrumb">
  <span class="repo-root js-repo-root"><span class="js-path-segment"><a data-pjax="true" href="/claytonbez/tcp-emit-server"><span>tcp-emit-server</span></a></span></span><span class="separator">/</span><strong class="final-path">README.md</strong>
</div>
<div class="commit-tease-contributors">
  <button type="button" class="btn-link muted-link contributors-toggle" data-facebox="#blob_contributors_box">
    <strong>1</strong>
     contributor
  </button>
  
</div>

<div id="blob_contributors_box" style="display:none">
  <h2 class="facebox-header" data-facebox-id="facebox-header">Users who have contributed to this file</h2>
  <ul class="facebox-user-list" data-facebox-id="facebox-description">
      <li class="facebox-user-list-item">
        <a class="d-inline-block" data-hovercard-user-id="6775201" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/claytonbez"><img src="https://avatars1.githubusercontent.com/u/6775201?s=48&amp;v=4" width="24" height="24" alt="@claytonbez" /></a>
        <a data-hovercard-user-id="6775201" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/claytonbez">claytonbez</a>
      </li>
  </ul>
</div>
<div class="BtnGroup">
  <a id="raw-url" class="btn btn-sm BtnGroup-item" href="/claytonbez/tcp-emit-server/raw/master/README.md">Raw</a>
    <a class="btn btn-sm js-update-url-with-hash BtnGroup-item" data-hotkey="b" href="/claytonbez/tcp-emit-server/blame/master/README.md">Blame</a>
  <a rel="nofollow" class="btn btn-sm BtnGroup-item" href="/claytonbez/tcp-emit-server/commits/master/README.md">History</a>
</div>

    <a class="btn-octicon tooltipped tooltipped-nw"
       href="https://desktop.github.com"
       aria-label="Open this file in GitHub Desktop"
       data-ga-click="Repository, open with desktop, type:windows">
        <svg class="octicon octicon-device-desktop" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z"/></svg>
    </a>

      <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="inline-form js-update-url-with-hash" action="/claytonbez/tcp-emit-server/edit/master/README.md" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="a0K+Jr0k7RTekyTmbyvuXdcGfWQF2koVUrLymI9UOjNEHYMkOGo8GUlCmdsd8lDRqw5CUguvu7jO3L0EAMZzDA==" />
        <button class="btn-octicon tooltipped tooltipped-nw" type="submit"
          aria-label="Edit this file" data-hotkey="e" data-disable-with>
          <svg class="octicon octicon-pencil" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"/></svg>
        </button>

server.on('connection',function(socket){

<span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">`</span>Socket <span class="pl-s1"><span class="pl-pse">${</span><span class="pl-smi">socket</span>.<span class="pl-smi">ipaddress</span><span class="pl-pse">}</span></span>:<span class="pl-s1"><span class="pl-pse">${</span><span class="pl-smi">socket</span>.<span class="pl-smi">ipport</span><span class="pl-pse">}</span></span> connected<span class="pl-pds">`</span></span>);
<span class="pl-c"><span class="pl-c">//</span>you can create any listener you like, ie. 'register'</span>
<span class="pl-smi">socket</span>.<span class="pl-en">on</span>(<span class="pl-s"><span class="pl-pds">'</span>register<span class="pl-pds">'</span></span>,<span class="pl-k">function</span>(<span class="pl-smi">username</span>,<span class="pl-smi">password</span>){ 
	<span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">`</span>Registering <span class="pl-s1"><span class="pl-pse">${</span>username<span class="pl-pse">}</span></span>,<span class="pl-s1"><span class="pl-pse">${</span>password<span class="pl-pse">}</span></span><span class="pl-pds">`</span></span>);
    <span class="pl-smi">socket</span>.<span class="pl-en">emit</span>(<span class="pl-s"><span class="pl-pds">'</span>register-done<span class="pl-pds">'</span></span>);
});
<span class="pl-c"><span class="pl-c">//</span>here is native events that emit on the socket object</span>
<span class="pl-smi">socket</span>.<span class="pl-en">on</span>(<span class="pl-s"><span class="pl-pds">'</span>data<span class="pl-pds">'</span></span>,<span class="pl-k">function</span>(<span class="pl-smi">buffer</span>){
	<span class="pl-k">var</span> data <span class="pl-k">=</span> <span class="pl-smi">buffer</span>.<span class="pl-c1">toString</span>();
	<span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">`</span>RAW SOCKET DATA: <span class="pl-s1"><span class="pl-pse">${</span>data<span class="pl-pse">}</span></span><span class="pl-pds">`</span></span>);
});
<span class="pl-smi">socket</span>.<span class="pl-en">on</span>(<span class="pl-s"><span class="pl-pds">'</span>disconnect<span class="pl-pds">'</span></span>,<span class="pl-k">function</span>(){
	<span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">`</span>Socket <span class="pl-s1"><span class="pl-pse">${</span><span class="pl-smi">socket</span>.<span class="pl-smi">ipaddress</span><span class="pl-pse">}</span></span>:<span class="pl-s1"><span class="pl-pse">${</span><span class="pl-smi">socket</span>.<span class="pl-smi">ipport</span><span class="pl-pse">}</span></span> DISCONNECTED<span class="pl-pds">`</span></span>);
});
<span class="pl-smi">socket</span>.<span class="pl-en">on</span>(<span class="pl-s"><span class="pl-pds">'</span>err<span class="pl-pds">'</span></span>,<span class="pl-k">function</span>(<span class="pl-smi">err</span>){
	<span class="pl-en">console</span>.<span class="pl-c1">log</span>(err); 
    <span class="pl-c"><span class="pl-c">//</span>when sockets don't close properly, this event will be emitted along side the disconnect event.</span>
});

});

socket.on('connect',function(){ console.log('connected to server'); socket.emit("register","myudername","mypassword"); }); socket.on('data',function(buffer){ //use this method is you purely want to read data received on the tcp socket. var data = buffer.toString(); console.log(</span>RAW SOCKET DATA: <span class="pl-s1"><span class="pl-pse">${</span>data<span class="pl-pse">}</span></span><span class="pl-pds">); }); socket.on('register-done',function(){ console.log("This client has been registered"); socket.close(); //closes the tcp connection to the server and destroyed all socket objects }); socket.on('disconnect',function(){ console.log('Disconnected From Server'); }); socket.on('reconnect',function(){ console.log('Reconnecting to Server'); }); socket.on('err',function(err){ console.log(err); });