The VS Code extension for Represence - provides presence detection by sharing file information via WebSocket.
- Download the
represence-vscode-0.0.2.vsixfile - Open VS Code
- Go to Extensions view (
Ctrl+Shift+XorCmd+Shift+X) - Click the "..." menu and select "Install from VSIX..."
- Select the downloaded
.vsixfile
code --install-extension represence-vscode-0.0.2.vsix- After installation, the extension automatically starts a WebSocket server on port
3847 - You'll see a notification: "Represence WebSocket server started on port 3847"
- The extension is now broadcasting your current file information!
The extension creates a WebSocket server that broadcasts information about your currently active file to any connected clients. This is perfect for:
- Live coding sessions - Show others what file you're working on
- Presence detection - Let external applications know your current context
- Development tools - Integration with custom dashboards or monitoring systems
The extension broadcasts a JSON object with:
{
"filename": "example.js",
"extension": ".js",
"path": "/full/path/to/example.js",
"language": "javascript",
"lineCount": 42,
"wordCount": 156,
"timestamp": "2024-01-01T12:00:00.000Z"
}Access settings via:
- Command Palette:
Ctrl+Shift+Pโ "Configure Represence Extension" - Or go to: File โ Preferences โ Settings โ Search for "fileInfo"
| Setting | Default | Description |
|---|---|---|
fileInfo.websocketPort |
3847 |
WebSocket server port (1024-65535) |
fileInfo.enableLogging |
false |
Enable verbose logging in developer console |
Environment variable support has been removed. Use VS Code settings instead.
Priority order: VS Code Setting > Default (3847)
Access these via Command Palette (Ctrl+Shift+P or Cmd+Shift+P):
| Command | Description |
|---|---|
Show Current File Info |
Display current file information in a popup |
Configure Represence Extension |
Open extension settings |
The extension automatically sends updates when:
- โ You switch to a different file
- โ You make changes to the current file
- โ You open/close files
const WebSocket = require('ws');
const ws = new WebSocket('ws://localhost:3847');
ws.on('open', () => {
console.log('Connected to Represence');
});
ws.on('message', (data) => {
const fileInfo = JSON.parse(data);
console.log('Current file:', fileInfo.filename);
console.log('Language:', fileInfo.language);
console.log('Lines:', fileInfo.lineCount);
});import websocket
import json
def on_message(ws, message):
file_info = json.loads(message)
print(f"Current file: {file_info['filename']}")
print(f"Language: {file_info['language']}")
print(f"Lines: {file_info['lineCount']}")
def on_open(ws):
print("Connected to Represence")
ws = websocket.WebSocketApp("ws://localhost:3847",
on_message=on_message,
on_open=on_open)
ws.run_forever()If you see "Failed to start WebSocket server on port 3847. Port might be in use":
- Change the port: Go to settings and change
fileInfo.websocketPortto a different number - Kill the process: Find what's using the port:
# Linux/Mac lsof -i :3847 # Windows netstat -ano | findstr :3847
- Check developer console: Help โ Toggle Developer Tools โ Console tab
- Enable logging: Set
fileInfo.enableLoggingtotruein settings - Reload VS Code: Command Palette โ "Developer: Reload Window"
- Ensure your firewall allows connections on the configured port
- Test the WebSocket connection with a simple client (see examples above)
- Check that no other application is using the same port
git clone <repository-url>
cd represence-vscode
npm install
npm run compilenpm install -g vsce
vsce package- Press
F5in VS Code to launch Extension Development Host - Test the extension in the new window
- Check the debug console for logs
This extension is open source. Check the repository for license details.
Found a bug or want to add a feature? Contributions are welcome!
Happy coding with Represence! ๐