{"id":15762973,"url":"https://github.com/jkremser/simple-websocket-vcr","last_synced_at":"2025-04-21T04:31:38.874Z","repository":{"id":56895869,"uuid":"54409314","full_name":"jkremser/simple-websocket-vcr","owner":"jkremser","description":":gem: Ruby gem for testing the Simple Websocket Client - VCR support :vhs: - https://rubygems.org/gems/simple-websocket-vcr","archived":false,"fork":false,"pushed_at":"2019-05-21T12:53:13.000Z","size":53,"stargazers_count":4,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T00:27:28.262Z","etag":null,"topics":["ruby-gem","websocket","websocket-vcr"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkremser.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-21T17:33:03.000Z","updated_at":"2024-02-28T08:16:20.000Z","dependencies_parsed_at":"2022-08-21T00:50:17.662Z","dependency_job_id":null,"html_url":"https://github.com/jkremser/simple-websocket-vcr","commit_stats":null,"previous_names":["jiri-kremser/simple-websocket-vcr"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkremser%2Fsimple-websocket-vcr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkremser%2Fsimple-websocket-vcr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkremser%2Fsimple-websocket-vcr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkremser%2Fsimple-websocket-vcr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkremser","download_url":"https://codeload.github.com/jkremser/simple-websocket-vcr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223849432,"owners_count":17213640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby-gem","websocket","websocket-vcr"],"created_at":"2024-10-04T11:23:39.804Z","updated_at":"2024-11-09T16:03:13.271Z","avatar_url":"https://github.com/jkremser.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple websocket VCR\n\n[![Build Status](https://travis-ci.org/Jiri-Kremser/simple-websocket-vcr.png?branch=master)](https://travis-ci.org/Jiri-Kremser/simple-websocket-vcr)\n[![Coverage](https://coveralls.io/repos/github/Jiri-Kremser/simple-websocket-vcr/badge.svg?branch=master)](https://coveralls.io/github/Jiri-Kremser/simple-websocket-vcr?branch=master)\n[![Code Climate](https://codeclimate.com/github/Jiri-Kremser/simple-websocket-vcr/badges/gpa.svg)](https://codeclimate.com/github/Jiri-Kremser/simple-websocket-vcr)\n[![Gem Version](https://badge.fury.io/rb/simple-websocket-vcr.svg)](https://badge.fury.io/rb/simple-websocket-vcr)\n\n\nBased on the idea of [vcr](https://github.com/vcr/vcr) project which record the http interactions and store them as files that can be replayed later and simulate the real communication counterpart (mostly server).\n\nHowever, this projects aims on the web socket protocol where normally there is only a single HTTP connection and multiple messages or frames being sent over the channel.\n\n\n### Usage\n\n```Ruby\n  it 'should record also the outgoing communication' do\n    WebSocketVCR.configure do |c|\n      c.hook_uris = [HOST]\n    end\n    WebSocketVCR.record(example, self) do\n      puts 'we are recording..' if WebSocketVCR.live?\n      url = \"ws://#{HOST}/hawkular/command-gateway/ui/ws\"\n      c = WebSocket::Client::Simple.connect url do |client|\n        client.on(:message, once: true, \u0026:data)\n      end\n      sleep 1 if WebSocketVCR.live?\n      c.send('something 1')\n      c.send('something 2')\n      c.send('something 3')\n\n      expect(c).not_to be nil\n      expect(c.open?).to be true\n    end\n  end\n```\n([source](https://github.com/Jiri-Kremser/simple-websocket-vcr/blob/master/spec/vcr_spec.rb#L46))\n\nafter running the code above, you should end up with a file that captured the interactions.\n\n```yaml\n---\nwebsocket_interactions:\n- - operation: read\n    event: message\n    type: text\n    data: WelcomeResponse={\"sessionId\":\"XQVVtE53wxz1lmMsqz2TbmR68ilFzDxLOOpkKGpd\"}\n  - operation: write\n    send: message\n    data: something 1\n  - operation: write\n    send: message\n    data: something 2\n  - operation: write\n    send: message\n    data: something 3\n```\n([source](spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_also_the_outgoing_communication.yml))\n\nFor more details consult the [specs](spec/vcr_spec.rb).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkremser%2Fsimple-websocket-vcr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkremser%2Fsimple-websocket-vcr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkremser%2Fsimple-websocket-vcr/lists"}