Skip to content

Commit

Permalink
Add swift count example with flush of STDOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmo committed Feb 19, 2015
1 parent 3624f88 commit eaad601
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/swift/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Add execute permission:
$ chmod +x count.swift

Run:
$ websocketd --port=8080 count.swift
12 changes: 12 additions & 0 deletions examples/swift/count.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env xcrun -sdk macosx swift

import AppKit

for index in 1...10 {
println(index)

// Flush output
fflush(__stdoutp)

NSThread.sleepForTimeInterval(0.5)
}

0 comments on commit eaad601

Please sign in to comment.